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 |
|---|---|---|---|---|---|---|
Ensure we can call drake_visualizer help in Bazel. | def test_help(self):
bin_path = "tools/drake_visualizer"
self.assertTrue(isfile(bin_path), bin_path)
text = subprocess.check_output([bin_path, "--help"], encoding="utf8")
# N.B. This should be kept in sync with
# `drake_visualizer_installed_help_test`.
print(text)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visualize_fallback(self):\n mol = Molecule().from_smiles(\"CCO\")\n with pytest.warns(UserWarning):\n mol.visualize(backend=\"rdkit\")",
"def test_visualize_fallback(self):\n mol = Molecule().from_smiles(\"CCO\")\n with pytest.warns(UserWarning):\n mol.v... | [
"0.60513806",
"0.60513806",
"0.59668136",
"0.59417623",
"0.58736",
"0.5774898",
"0.5590708",
"0.55842257",
"0.55842257",
"0.55677456",
"0.55466443",
"0.55422544",
"0.5541067",
"0.55272883",
"0.5493049",
"0.5487422",
"0.54439217",
"0.5440259",
"0.5440259",
"0.5432543",
"0.5384... | 0.6629841 | 0 |
Generate pg_num pg_num is generated as the number of OSDs across the cluster multiplied by 100, divided by Ceph replication factor, and rounded up to the nearest power of 2. | def _set_pg_count_storage_parameters(cls, data, nodes):
osd_num = 0
osd_nodes = [node for node in nodes
if 'ceph-osd' in node.all_roles]
for node in osd_nodes:
for disk in cls.get_node_volumes(node):
for part in disk.get('volumes', []):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getGlideinCpusNum(glidein):\n \n glidein_cpus = 1\n cpus = str(glidein['attrs'].get('GLIDEIN_CPUS', 1))\n if cpus.upper() == 'AUTO':\n glidein_cpus = 1\n else:\n glidein_cpus = int(cpus)\n\n return glidein_cpus",
"def acc_num_gen():\n try:\n max_agg = Dataset.objects.all().a... | [
"0.5666871",
"0.5592697",
"0.5562598",
"0.5393916",
"0.5364486",
"0.5357671",
"0.534785",
"0.53252494",
"0.5297828",
"0.52916896",
"0.52761304",
"0.52450645",
"0.5231396",
"0.51764846",
"0.5171881",
"0.5168544",
"0.5145136",
"0.5137617",
"0.5130208",
"0.5130208",
"0.5107288",... | 0.6028018 | 0 |
True if node disk requires checking | def _is_disk_checking_required(cls, node):
if (node.status in (consts.NODE_STATUSES.ready,
consts.NODE_STATUSES.deploying,
consts.NODE_STATUSES.provisioned) or
(node.status == consts.NODE_STATUSES.error and
node.error_type ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_disk_usage(disk):\n du = shutil.disk_usage(disk)\n free = du.free / du.total * 100\n return free > 20",
"def _check_mounted_system(self):\n res = self.su_cmd('touch /system/.dwarf_check')\n if res == '':\n res = self._do_adb_command('shell ls -la /system')\n ... | [
"0.6628182",
"0.66001797",
"0.65721416",
"0.6472541",
"0.6466661",
"0.64647245",
"0.63887674",
"0.6327493",
"0.63195205",
"0.62643796",
"0.62489504",
"0.6234156",
"0.6154878",
"0.61479956",
"0.60348433",
"0.60066736",
"0.599617",
"0.5995826",
"0.59895515",
"0.5975714",
"0.596... | 0.8037184 | 0 |
Get Marvin Probe ID for expect auto run. | def getMarvinProbeID(cableName, path_sn):
# 处理未格式化的 cablename 字符串
cableName_0 = cableName
if re.search("-", cableName_0):
cableName_0 = cableName_0.split("-")[1]
res, rev = readCMD(["%s/runMarvin.exp"%(script_path)], True, path_sn)
for item in rev:
if re.search(cableName_0, item):
probeID=re.search("[0-9]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMarvinProbeID(cableName):\n\t# 处理未格式化的 cablename 字符串\n\tcableName_0 = cableName\n\tif re.search(\"-\", cableName_0):\n\t\tcableName_0 = cableName_0.split(\"-\")[1]\n\t# writeLogs(\"Python script current path = %s\" %script_path)\n\tres, rev = readCMD([\"%s/runMarvin.rep\"%(script_path)], False, 2)\n\tfor it... | [
"0.64271843",
"0.6238161",
"0.6168897",
"0.60843885",
"0.57512033",
"0.5719016",
"0.55644125",
"0.55429316",
"0.55022645",
"0.54740715",
"0.538244",
"0.5380117",
"0.5380117",
"0.5322663",
"0.529911",
"0.5297257",
"0.523719",
"0.5199766",
"0.5187079",
"0.5180979",
"0.5177931",... | 0.62567574 | 1 |
Get Astris Probe ID for expect auto run. | def getAstrisProbeID(cableName, path_sn):
# 处理未格式化的 cablename 字符串
cableName_0 = cableName
if re.search("-", cableName_0):
cableName_0 = cableName_0.split("-")[1]
res, rev = readCMD([script_path+"/runAstrisID.exp"], True, path_sn)
for item in rev:
if re.search(cableName_0, item):
probeID = re.search( "[0-9]{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAstrisProbeID(cableName):\n\t# 处理未格式化的 cablename 字符串\n\tcableName_0 = cableName\n\tif re.search(\"-\", cableName_0):\n\t\tcableName_0 = cableName_0.split(\"-\")[1]\n\t# writeLogs(\"Python script current path = %s\" %script_path)\n\tres, rev = readCMD([script_path+\"/auto_reset.rep\", \"-1\"], False)\n\tfor ... | [
"0.63445914",
"0.6018172",
"0.5957744",
"0.57805705",
"0.54946333",
"0.5481445",
"0.5373998",
"0.5343673",
"0.53005284",
"0.52937484",
"0.5198197",
"0.51904076",
"0.51841384",
"0.5179261",
"0.5168335",
"0.5163309",
"0.5162205",
"0.5153474",
"0.51299876",
"0.50734675",
"0.5055... | 0.625481 | 1 |
This function verifies the relative controller_fs sizes. | def _check_relative_controller_multi_fs(controller_fs_new_list):
chosts = pecan.request.dbapi.ihost_get_by_personality(constants.CONTROLLER)
for chost in chosts:
# Get the current backup size for the controller host
backup_gib = 0
backup_gib_min = constants.BACKUP_OVERHEAD
ho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_relative_controller_fs(controller_fs_new, controller_fs_list):\n\n database_gib = 0\n platform_gib = 0\n\n chosts = pecan.request.dbapi.ihost_get_by_personality(\n constants.CONTROLLER)\n\n for chost in chosts:\n # Get the current backup size for the controller host\n ba... | [
"0.7195793",
"0.6836779",
"0.63191617",
"0.62395287",
"0.61080986",
"0.60821587",
"0.5965518",
"0.591759",
"0.59106827",
"0.58877504",
"0.5886119",
"0.580457",
"0.5800463",
"0.5788363",
"0.5781739",
"0.5774328",
"0.57727885",
"0.5697294",
"0.5676444",
"0.5661684",
"0.56560373... | 0.6970024 | 1 |
This function verifies the relative controller_fs sizes. | def _check_relative_controller_fs(controller_fs_new, controller_fs_list):
database_gib = 0
platform_gib = 0
chosts = pecan.request.dbapi.ihost_get_by_personality(
constants.CONTROLLER)
for chost in chosts:
# Get the current backup size for the controller host
backup_gib = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_relative_controller_multi_fs(controller_fs_new_list):\n\n chosts = pecan.request.dbapi.ihost_get_by_personality(constants.CONTROLLER)\n\n for chost in chosts:\n\n # Get the current backup size for the controller host\n backup_gib = 0\n backup_gib_min = constants.BACKUP_OVERHEA... | [
"0.6970024",
"0.6836779",
"0.63191617",
"0.62395287",
"0.61080986",
"0.60821587",
"0.5965518",
"0.591759",
"0.59106827",
"0.58877504",
"0.5886119",
"0.580457",
"0.5800463",
"0.5788363",
"0.5781739",
"0.5774328",
"0.57727885",
"0.5697294",
"0.5676444",
"0.5661684",
"0.56560373... | 0.7195793 | 0 |
This function verifies the administrative, operational, availability of each controller. | def _check_controller_state():
chosts = pecan.request.dbapi.ihost_get_by_personality(
constants.CONTROLLER)
for chost in chosts:
utils.is_host_state_valid_for_fs_resize(chost)
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_controller_initialization(self):\n for name in self.our_controllers:\n self.assertTrue(self.check_state(name, 'initialized'), \"{} is initialized correctly\".format(name))",
"def test_invalid_controller_initialization(self):\n for name in self.invalid_controllers:\n s... | [
"0.66650355",
"0.6404735",
"0.63629115",
"0.6313509",
"0.6090917",
"0.6085347",
"0.6067711",
"0.6045928",
"0.6017901",
"0.5966347",
"0.5955847",
"0.591076",
"0.5908557",
"0.5830892",
"0.5798163",
"0.57782197",
"0.5768421",
"0.5768421",
"0.5751914",
"0.57505393",
"0.5737908",
... | 0.6907755 | 0 |
Check growth of ceph_mon in controller. There is additional items to check for controller_fs compared with check_node_ceph_mon_growth(). | def _check_ceph_mon_growth(ceph_mon_gib):
controller_fs_list = pecan.request.dbapi.controller_fs_get_list()
cgtsvg_max_free_GiB = _get_controller_cgtsvg_limit()
LOG.info("_check_ceph_mon_growth ceph_mon_gib = %s, "
"cgtsvg_max_free_GiB = %s" % (ceph_mon_gib, cgtsvg_max_free_GiB))
_check_relat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_controller_multi_fs_data(context, controller_fs_list_new):\n\n cgtsvg_growth_gib = 0\n\n lvdisplay_keys = [constants.FILESYSTEM_LV_DICT[constants.FILESYSTEM_NAME_DATABASE],\n constants.FILESYSTEM_LV_DICT[constants.FILESYSTEM_NAME_PLATFORM]]\n\n lvdisplay_dict = pecan.reques... | [
"0.66720474",
"0.59837383",
"0.59288394",
"0.56238663",
"0.5614252",
"0.51726645",
"0.5047841",
"0.49779254",
"0.49391177",
"0.49246004",
"0.49070847",
"0.4893909",
"0.4808446",
"0.4803836",
"0.4799989",
"0.4799989",
"0.4799989",
"0.47816777",
"0.47695023",
"0.47565237",
"0.4... | 0.8220885 | 0 |
Check controller filesystem data and return growth | def _check_controller_multi_fs_data(context, controller_fs_list_new):
cgtsvg_growth_gib = 0
lvdisplay_keys = [constants.FILESYSTEM_LV_DICT[constants.FILESYSTEM_NAME_DATABASE],
constants.FILESYSTEM_LV_DICT[constants.FILESYSTEM_NAME_PLATFORM]]
lvdisplay_dict = pecan.request.rpcapi.get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_relative_controller_fs(controller_fs_new, controller_fs_list):\n\n database_gib = 0\n platform_gib = 0\n\n chosts = pecan.request.dbapi.ihost_get_by_personality(\n constants.CONTROLLER)\n\n for chost in chosts:\n # Get the current backup size for the controller host\n ba... | [
"0.6431274",
"0.61469126",
"0.5928459",
"0.5888471",
"0.58249396",
"0.5609938",
"0.5578576",
"0.55723834",
"0.5519237",
"0.5518268",
"0.54665786",
"0.5413347",
"0.538723",
"0.5356096",
"0.5351515",
"0.5349176",
"0.5343423",
"0.53345656",
"0.5327628",
"0.5324215",
"0.53157544"... | 0.7369138 | 0 |
Retrieve a list of controller_fs with detail. | def detail(self, isystem_uuid=None, marker=None, limit=None,
sort_key='id', sort_dir='asc'):
parent = pecan.request.path.split('/')[:-1][-1]
if parent != "controller_fs":
raise exception.HTTPNotFound
expand = True
resource_url = '/'.join(['controller_fs', 'de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_controller(cls, args, config):\n controllers = config.list_objects(kind='Controller')\n if len(controllers) == 0:\n return {'msg': \"No controllers configured\"}\n else:\n table_data = []\n for c in controllers:\n try:\n ... | [
"0.57429844",
"0.5730243",
"0.5660251",
"0.55606866",
"0.5471861",
"0.5456",
"0.5409786",
"0.5363983",
"0.52677065",
"0.5232202",
"0.5211702",
"0.5150053",
"0.50639504",
"0.5031951",
"0.5031498",
"0.49742493",
"0.4964372",
"0.49430948",
"0.49110556",
"0.49061",
"0.49042037",
... | 0.6413918 | 0 |
Retrieve information about the given controller_fs. | def get_one(self, controller_fs_uuid):
if self._from_isystems:
raise exception.OperationNotPermitted
rpc_controller_fs = \
objects.controller_fs.get_by_uuid(pecan.request.context,
controller_fs_uuid)
return ControllerFs.conve... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detail(self, isystem_uuid=None, marker=None, limit=None,\n sort_key='id', sort_dir='asc'):\n\n parent = pecan.request.path.split('/')[:-1][-1]\n if parent != \"controller_fs\":\n raise exception.HTTPNotFound\n\n expand = True\n resource_url = '/'.join(['cont... | [
"0.61026657",
"0.5864313",
"0.5846265",
"0.56615895",
"0.55557954",
"0.5488714",
"0.5454654",
"0.5450636",
"0.5319423",
"0.53107834",
"0.5301508",
"0.5248033",
"0.51881325",
"0.5147472",
"0.5109857",
"0.5090395",
"0.5086451",
"0.5069935",
"0.5044003",
"0.5042653",
"0.50382936... | 0.68302584 | 0 |
Create a new controller_fs. | def post(self, controllerfs):
raise exception.OperationNotPermitted | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, filesystem=None):\n raise NotImplementedError()",
"def create_controller() -> Controller:\n _controller = Controller()\n return _controller",
"def _mkfs (self,blockDevice,timer):\n # build command string\n fsTypeString = None\n if (self._activeFileSystemConfig... | [
"0.6272269",
"0.6121895",
"0.60761386",
"0.5989525",
"0.5832158",
"0.58279073",
"0.5695869",
"0.5695869",
"0.5656866",
"0.5586747",
"0.55672383",
"0.55318457",
"0.55152637",
"0.5486903",
"0.53985316",
"0.5396727",
"0.536542",
"0.5348088",
"0.5320643",
"0.5318966",
"0.531464",... | 0.65536445 | 0 |
Create an event callback for ending a modal dialog. | def EndModalClosure(self, dialog, code):
def EndModal(evt):
dialog.EndModal(code)
return EndModal | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _close(self, event):\n self.EndModal(wx.ID_OK)",
"def closeEvent(self, event) -> None:\n global dialog\n dialog = None",
"def onClose(self, event):\n pass",
"def onClose(self, event):\n pass",
"def onClose(self, event):\n pass",
"def onClose(self, event): \n ... | [
"0.70222825",
"0.6991652",
"0.6588543",
"0.6588543",
"0.6588543",
"0.6494187",
"0.64842385",
"0.6479235",
"0.63988763",
"0.6381461",
"0.63392264",
"0.6310711",
"0.6295044",
"0.627313",
"0.6205349",
"0.6197298",
"0.61632687",
"0.6137161",
"0.6134943",
"0.6121245",
"0.6099107",... | 0.8090125 | 0 |
Bind events on our dialog. In the base class we only bind the Update (OK) and Cancel buttons. We define wx.ID_OK as the return of an 'Update'. self.dialog must have OK/Update and Cancel buttons. | def MakeBindingsOKCancel(self):
dialog = self.dialog
if hasattr(dialog, 'update_button'):
ok_or_update_button = dialog.update_button
else:
ok_or_update_button = dialog.ok_button
dialog.Bind(wx.EVT_BUTTON, self.EndModalClosure(dialog, wx.ID_OK),
ok_or_update_button)
dialog... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_controls(self):\n self.add_comment_button.Bind(wx.EVT_BUTTON, self.add_comment)\n self.del_comment_button.Bind(wx.EVT_BUTTON, self.remove_comment)\n self.upload_button.Bind(wx.EVT_BUTTON, self.upload_change)\n self.Bind(wx.EVT_CLOSE, self.on_close)",
"def _setup_events(self):... | [
"0.61649984",
"0.57537854",
"0.565205",
"0.5617502",
"0.5372594",
"0.5366404",
"0.5359269",
"0.5319438",
"0.52896833",
"0.5272374",
"0.5246374",
"0.5234253",
"0.5208511",
"0.51947004",
"0.51262236",
"0.5119228",
"0.5104777",
"0.5099522",
"0.50618976",
"0.50481415",
"0.5021549... | 0.7028662 | 0 |
returns all children of the root XML document This is just an alias to self.soup.getchildren() | def getchildren(self):
return self.root.getchildren() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_children_elements(self):\n\n pass",
"def children(self):\n l = []\n n = self.node.firstChild\n while n:\n l.append(XmlWrapper(n))\n n = n.nextSibling\n return l",
"def children(self):\n l = []\n n = self.node.firstChild\n whi... | [
"0.78669983",
"0.7769469",
"0.7769469",
"0.7580862",
"0.74517626",
"0.7420861",
"0.74180883",
"0.73901707",
"0.7386414",
"0.7386414",
"0.7386414",
"0.7321154",
"0.72741795",
"0.7262599",
"0.7254636",
"0.72425103",
"0.71384245",
"0.7108148",
"0.71079236",
"0.71079236",
"0.7096... | 0.8110493 | 0 |
First we get the id variable from our route. It will be present in the matchdict property of the request object (recall that the request object is created ????). All of our defined route args will end up there. After we get the entry id, it will be passed to BlogRecordService class method by_id() to fetch a specific bl... | def blog_view(request):
blog_id = int(request.matchdict.get('id', -1))
entry = BlogRecordService.by_id(blog_id, request)
if not entry:
return HTTPNotFound
return {'entry': entry} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, id):\n\n post = Post.get_by_id(int(id))\n if post:\n #t = jinja_env.get_template(\"post.html\")\n #response = t.render(post=post)\n self.render(\"post.html\", post=post)\n else:\n error = \"there is no post with id %s\" % id\n ... | [
"0.6260978",
"0.62375754",
"0.6209065",
"0.61689496",
"0.6137767",
"0.60712445",
"0.60396683",
"0.5955774",
"0.59180415",
"0.589982",
"0.58963364",
"0.58863",
"0.5854794",
"0.5838113",
"0.58256954",
"0.582377",
"0.5814288",
"0.5799507",
"0.57826334",
"0.5778158",
"0.57673585"... | 0.760463 | 0 |
We implement a view callable that will handle new entries for us. create a new entry row and form object from BlogCreateForm the form will be populated by POST, if present if the request method is POST, the form gets validated If the form is validated, our form sets it values to the model instance and adds it to the da... | def blog_create(request):
entry = BlogRecord()
form = BlogCreateForm(request.POST)
if request.method == 'POST' and form.validate():
form.populate_obj(entry)
request.dbsession.add(entry)
return HTTPFound(location=request.route_url('home'))
return {'form': form, 'action': request.m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(request):\n\n if request.method == 'POST':\n data = request.POST\n form = BlogEntryForm(creator=request.user, data=data)\n if form.is_valid():\n form.save()\n # Should we redirect to single entry view or to all?\n return HttpResponseRedirect(reverse(... | [
"0.7772446",
"0.7191532",
"0.7090793",
"0.7044764",
"0.6951431",
"0.6867541",
"0.6849899",
"0.6685917",
"0.6652119",
"0.6605787",
"0.66010433",
"0.6598258",
"0.6597896",
"0.65632",
"0.6551013",
"0.6528886",
"0.6524015",
"0.6474454",
"0.6461428",
"0.6429426",
"0.64137924",
"... | 0.7815612 | 0 |
The following view will handle updates to existing blog entries. Fetch the blog entry from the DB show a 404 Not Found page if the record requested is not present Create the form object, populating it from the POST params or from the actual blog entry, if we haven't POSTed any values yet. This approach ensures our form... | def blog_update(request):
blog_id = int(request.params.get('id', -1))
entry = BlogRecordService.by_id(blog_id, request)
if not entry:
return HTTPNotFound()
form = BlogUpdateForm(request.POST, entry)
if request.method == 'POST' and form.validate():
del form.id # SECURITY: prevent ove... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blogEdit(request, urlname):\n\tblog = Blog.objects.get(authors=request.user, urlname=urlname)\n\tsections = [(s.pk, s.name) for s in blog.blogsection_set.all()]\n\teditor = request.user in blog.editors.all()\n\tif request.method == 'POST':\n\t\tform = BlogForm(request.POST, sections=sections)\n\t\tif form.is_v... | [
"0.6911305",
"0.68668735",
"0.68196565",
"0.6571532",
"0.65208185",
"0.64720726",
"0.646518",
"0.6462519",
"0.64237285",
"0.63464147",
"0.6345143",
"0.61879516",
"0.618442",
"0.6175245",
"0.6172073",
"0.61398554",
"0.6115545",
"0.60836434",
"0.60737026",
"0.6003296",
"0.59894... | 0.8398938 | 0 |
Converts dispatch type string into an enum constant | def parse_dispatch_type(dispatch_string: str):
if not dispatch_string:
return None
dispatch_string = dispatch_string.lower().strip()
if dispatch_string == "load":
return DispatchType.LOAD
if dispatch_string == "generating":
return DispatchType.GENERATOR
if dispatch_string... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_str(type_string):\n\t\tglobal type_enum\n\t\tif type_string == \"V\":\n\t\t\treturn MoviesType.V\n\t\telif type_string == \"VG\":\n\t\t\treturn MoviesType.VG\n\t\telif type_string == \"TV\":\n\t\t\treturn MoviesType.TV\n\t\telse:\n\t\t\treturn MoviesType.M",
"def from_string(cls, name: str) -> Enum:",
... | [
"0.69141954",
"0.684931",
"0.66742194",
"0.6609294",
"0.6177172",
"0.61709213",
"0.6170304",
"0.59220666",
"0.58646095",
"0.57183707",
"0.57054454",
"0.5705423",
"0.56439924",
"0.56355023",
"0.5605676",
"0.55983424",
"0.559413",
"0.5586988",
"0.5566283",
"0.5549336",
"0.55158... | 0.7736837 | 0 |
Run a BCMD Model. | def run_model(model):
model.create_initialised_input()
model.run_from_buffer()
output = model.output_parse()
return output | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def runModel(self):\n qsub= subprocess.check_output('which qsub',shell=True).strip()\n cmd = '#!/bin/bash\\n'\n cmd += '#PBS -N {0}\\n#PBS -V\\n#PBS -q gen1\\n#PBS -l nodes=1:ppn=1\\n'\n cmd += 'cd $PBS_O_WORKDIR\\nmpirun mcnpx inp={1} name={2}\\n'\n job = cmd.format('Job_RPMCyli... | [
"0.68819493",
"0.6610775",
"0.653322",
"0.6480858",
"0.64199233",
"0.6259903",
"0.6247876",
"0.6230625",
"0.6165507",
"0.6133447",
"0.61264765",
"0.61248076",
"0.6083756",
"0.60776675",
"0.6077297",
"0.6033316",
"0.6028291",
"0.6028291",
"0.60277355",
"0.6025652",
"0.602424",... | 0.70777535 | 0 |
Read desired value from sysfs file | def _read_sysfs(filename):
with open(filename) as sysfs:
value = sysfs.readline().strip("\n")
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_value(path):\n read_value = 0\n if not os.path.exists(path):\n # Path will generally only exist on a Raspberry Pi\n pass\n else:\n with open(path) as f:\n read_value = int(f.read())\n return read_value",
"def _sysfs_gpio_value_path(self) -> str:\n retu... | [
"0.631708",
"0.6227698",
"0.5995414",
"0.58990777",
"0.58924085",
"0.58296394",
"0.57631356",
"0.57262385",
"0.5672563",
"0.56495476",
"0.5619575",
"0.5550375",
"0.5542338",
"0.55301315",
"0.55211514",
"0.5487666",
"0.5440254",
"0.5440254",
"0.54375845",
"0.5430444",
"0.53831... | 0.7842276 | 0 |
Get the max power consumption of CPU | def _get_max_power_consumption(cpu):
powercap_cpu_base = os.path.join(
BASE_POWERCAP_PATH, "intel-rapl:{}".format(cpu.node_id))
try:
path = os.path.join(powercap_cpu_base, "max_energy_range_uj")
cons_max = int(_read_sysfs(path))
# uJ to J
cons_max /= 1000000.0
except ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maxcpu(self):\n return self._max_cpu['uid']",
"def get_maximum_cpu_load():\n if psutil is not None:\n return max(psutil.cpu_percent(percpu=True))\n else:\n return get_random_cpu_load()",
"def getMaxPower(self):\n return self.max_power",
"def max_power(self):\r\n e... | [
"0.7537433",
"0.74387926",
"0.7279702",
"0.71426463",
"0.7140444",
"0.6951023",
"0.6941144",
"0.6858993",
"0.67931443",
"0.6763755",
"0.6692022",
"0.6652052",
"0.66213584",
"0.65978146",
"0.653342",
"0.6529089",
"0.6500773",
"0.6443194",
"0.642686",
"0.64198786",
"0.64155155"... | 0.8119868 | 0 |
Receives two images in a list, in numpy array format and joins them horizontally | def join_images_horizontally(images):
array = np.concatenate((images[0], images[1]), axis=1)
return Image.fromarray(np.uint8(array)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def joinImages(imgs):\n d = imgs.shape[0]\n h, w = imgs.shape[1], imgs.shape[2]\n colour = imgs.shape[3]\n img = np.zeros((h, w * d, colour))\n for idx, image in enumerate(imgs):\n i = idx\n img[0:h, i * w:i * w + w, :] = image\n return ((img * 255.) + 1) * 2",
"def appendimages(i... | [
"0.72888696",
"0.71765864",
"0.7038031",
"0.7015019",
"0.68957597",
"0.6891867",
"0.68076974",
"0.6777537",
"0.6745875",
"0.66884685",
"0.6666639",
"0.66577035",
"0.6656798",
"0.66427594",
"0.6636108",
"0.6551063",
"0.6518982",
"0.64936435",
"0.6407374",
"0.6355334",
"0.62630... | 0.81474894 | 0 |
Receives a panorama picture of 3600x1600 pixels aprox, slice the image in two parts horizontally, and resize each part to 480x360 | def slice_and_resize(img_path):
# read image
img = Image.open(img_path)
width, height = img.size
#slice image in 2 parts horizontally, not looping
image_parts = []
step = width/2
image_parts.append(img.crop((0, 0, step, height)))
image_parts.append(img.crop((step, 0, step*2, height)))
# resize imag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def long_slice(image_path, out_name, outdir, slice_size, net):\n img = Image.open(image_path)\n imgout = Image.open(image_path)\n orw, orh = img.size\n width, height = img.size\n slicesh = int(math.ceil(height/slice_size))\n slicesw = int(math.ceil(width/slice_size))\n img = img.resize((slices... | [
"0.6060268",
"0.58518493",
"0.5817496",
"0.58161485",
"0.5703811",
"0.57006794",
"0.5688741",
"0.56454927",
"0.5643988",
"0.5619278",
"0.5618449",
"0.56108516",
"0.5601148",
"0.5600672",
"0.5596151",
"0.55757225",
"0.5558613",
"0.55409324",
"0.55403936",
"0.5500145",
"0.54996... | 0.6516747 | 0 |
Gets a panorama image of 3600x1600 pixels aprox. and returns a path to a resized 960x360 image. | def get_normal_image(image_path):
resized_images = slice_and_resize(image_path)
normal_full_img = join_images_horizontally(resized_images)
folder = "static/images/panorama"
name = next(tempfile._get_candidate_names())
normal_path = "%s/%s_resized.png" % (folder, name)
normal_full_img.save(normal_path)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_url_for_min_resolution(self, min_height, min_width, image):",
"def take_door_photo():\n\n # based on lukec's code in VHS.pm\n config = yaml.load(file('/etc/vhs.yaml'))\n short_hash = hashlib.sha256(str(datetime.datetime.now())).hexdigest()[0:6]\n pic_base = config.get('picture_base')\n if ... | [
"0.57882905",
"0.5691616",
"0.5631776",
"0.5500399",
"0.5458533",
"0.5445717",
"0.54240525",
"0.54175067",
"0.54111433",
"0.53764826",
"0.53647244",
"0.5320644",
"0.5316626",
"0.5314724",
"0.5290654",
"0.5265117",
"0.52544934",
"0.5235603",
"0.52055866",
"0.5185893",
"0.51775... | 0.660009 | 0 |
Gets a normal image and a segmented image, and uses the segmented sky (gray) from segmented image to crop from the normal image. Save it and return the path. | def get_masked_image(normal_image, segmented_image):
color = [128, 128, 128]
# create boundaries, same color but needs two arguments later on
lower = np.array(color, dtype="uint8")
upper = np.array(color, dtype="uint8")
# find the colors within the boundaries and apply the mask
mask = cv2.inRange(segmented... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cropped_image(normal_path, segment_path):\n normal_img = cv2.imread(normal_path)\n segment_img = cv2.imread(segment_path)\n\n cropped_path = get_masked_image(normal_img, segment_img)\n\n return cropped_path",
"def segment_image(image_path):\n image_array = cv2.imread(image_path)\n image_array =... | [
"0.75432515",
"0.6295083",
"0.61499316",
"0.606845",
"0.6006596",
"0.60016215",
"0.5977044",
"0.5918276",
"0.58975244",
"0.58316404",
"0.58003515",
"0.57528585",
"0.5686617",
"0.56647956",
"0.5646911",
"0.5633135",
"0.5603352",
"0.5586653",
"0.54830503",
"0.5482963",
"0.54766... | 0.6811809 | 1 |
Gets two paths for a normal and a segment image, and return a path to a cropped sky image. | def get_cropped_image(normal_path, segment_path):
normal_img = cv2.imread(normal_path)
segment_img = cv2.imread(segment_path)
cropped_path = get_masked_image(normal_img, segment_img)
return cropped_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segment_image(image_path):\n image_array = cv2.imread(image_path)\n image_array = cv2.resize(image_array, (2048, 2048))\n gray_image = cv2.cvtColor(image_array, cv2.COLOR_BGR2GRAY)\n _, threshold = cv2.threshold(\n gray_image, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU\n )\n # ass... | [
"0.57509774",
"0.5671519",
"0.56553066",
"0.5614875",
"0.5589399",
"0.55241513",
"0.55209994",
"0.5517443",
"0.5500031",
"0.54208946",
"0.5391353",
"0.5378793",
"0.5327713",
"0.52878004",
"0.52430266",
"0.52047527",
"0.5184939",
"0.5176107",
"0.51494706",
"0.5147592",
"0.5126... | 0.6860487 | 0 |
Calculate the average of a metric over all words in the thesaurus Words that not in the ground truth thesaurus are not used They are reported seperately | def average(thesaurus, ground_truth, function=precision, n=None):
not_included = 0
cum_sum = 0
for word in thesaurus:
if word in ground_truth and len(ground_truth[word]) != 0:
words = thesaurus[word]
if n is not None:
words = words[:n]
cum_sum += f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_averaging(wv, words):\n all_words, mean = set(), []\n \n for word in words:\n if isinstance(word, np.ndarray):\n mean.append(word)\n elif word in wv.vocab:\n mean.append(wv.vectors_norm[wv.vocab[word].index])\n all_words.add(wv.vocab[word].index)\n\n... | [
"0.7205572",
"0.71205884",
"0.68308556",
"0.66891056",
"0.6563663",
"0.6489295",
"0.6442225",
"0.6377907",
"0.6296907",
"0.6296907",
"0.6283479",
"0.62441826",
"0.62216353",
"0.62128055",
"0.6199504",
"0.6197554",
"0.61778814",
"0.61405855",
"0.6134396",
"0.60958046",
"0.6081... | 0.7561535 | 0 |
Modifies recent_sessions. If show_recent is True, leaves ended requests for OLD_INFO_EXPIRE_SECS after they end. | def clean_old_info(recent_sessions, include_ended):
expire_secs = OLD_INFO_EXPIRE_SECS if include_ended else 0
now = time()
i = 0
while i < len(recent_sessions):
session = recent_sessions[i]
if session.end and now - session.end > expire_secs:
recent_sessions.pop(i)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_recent_tracks(self):\n logger.debug('updating recent tracks')\n\n try:\n tracks = self.net.recently_played_tracks(response_limit=self.request_size)\n for track in tracks:\n if track.played_at not in [i.played_at for i in self.recent_tracks]:\n ... | [
"0.55517185",
"0.5154616",
"0.51291656",
"0.51291656",
"0.50187284",
"0.49854672",
"0.49817356",
"0.49699464",
"0.49238038",
"0.4852386",
"0.48258486",
"0.48146713",
"0.47552958",
"0.47189653",
"0.46851388",
"0.46778175",
"0.46739239",
"0.46719673",
"0.46689934",
"0.46187276",
... | 0.69257766 | 0 |
Handle an error; method called when accessing a nonexistent key. Automatically populate the given key with an instance of the factory. | def __missing__(self, key):
self[key] = self.factory(key)
return self[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_factory_invalid(self):\n order_processor = OrderProcessor()\n self.assertRaises(KeyError,\n order_processor.get_factory('AppleRepublic'))",
"def get(self, key: Hashable) -> Any: # type: ignore\n try:\n return[key]\n except (KeyError, Ty... | [
"0.6850937",
"0.64945537",
"0.6462939",
"0.62666583",
"0.6237834",
"0.623508",
"0.608725",
"0.60239565",
"0.5989592",
"0.59789646",
"0.59697944",
"0.5962485",
"0.59414464",
"0.593967",
"0.5918992",
"0.5918992",
"0.5901937",
"0.5901937",
"0.5864931",
"0.5804697",
"0.57682604",... | 0.69431347 | 0 |
Convert to bool; a helper is True if installed and False if not. | def __bool__(self):
return self.installed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installable(self):\n for pm_name in self._provider_package:\n if helpers[pm_name]:\n return True\n return False",
"def is_helper(self):\n return self.__class__._helper_",
"def is_installed(self):\n pass",
"def is_installed(self):\n return not s... | [
"0.67667663",
"0.62541676",
"0.61089945",
"0.6070893",
"0.60495067",
"0.6035306",
"0.596504",
"0.58483315",
"0.5842967",
"0.5763183",
"0.5721372",
"0.5700655",
"0.5690498",
"0.5671052",
"0.56308717",
"0.5626675",
"0.562432",
"0.5618881",
"0.5557684",
"0.5541383",
"0.55392283"... | 0.68657225 | 0 |
Get a URI for more information about this helper. | def info_uri(self):
return self._info_uri | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_uri(self):\r\n return self.uri",
"def uri(self) -> str:\n return self._uri",
"def get_uri(self):\n return self.url",
"def get_uri(self):\n return self.__uri",
"def uri(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"uri\")",
"def uri(self):\n ret... | [
"0.7113511",
"0.7003778",
"0.6976048",
"0.69596684",
"0.6958454",
"0.6827636",
"0.6827636",
"0.6827636",
"0.6827636",
"0.6827636",
"0.6827636",
"0.68259054",
"0.67751926",
"0.6774957",
"0.67441773",
"0.67229444",
"0.66979694",
"0.65891546",
"0.6574167",
"0.65572155",
"0.65366... | 0.7209087 | 0 |
Return a RuntimeError or NotImplementedError for install trouble. | def unsure_how_to_install(self):
msg = "Unsure how to install {0}.".format(self.name)
if self.info_uri:
msg += "\nRefer to {0} for information".format(self.info_uri)
if platform.system() == 'Darwin':
if 'brew' in self._provider_package and not helpers['brew']:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def install(self):\n raise NotImplementedError",
"def test_install_plugin_again_is_ok(self):\n raise NotImplementedError()",
"def post_installation(self, exc_value):\n pass",
"def install_from_rpm_py_package(self):\n raise NotImplementedError('Implement this method.')",
"def che... | [
"0.6547895",
"0.61016613",
"0.58986306",
"0.58805597",
"0.58061326",
"0.57856137",
"0.5675442",
"0.55675465",
"0.5561398",
"0.55466783",
"0.55238914",
"0.55152845",
"0.5484117",
"0.5469896",
"0.54528874",
"0.54208314",
"0.5418239",
"0.54173005",
"0.541634",
"0.541154",
"0.540... | 0.6813041 | 0 |
Context manager for downloading and expanding a .tar.gz file. Creates a temporary directory, downloads the specified URL into the directory, unzips and untars the file into this directory, then yields to the given block. When the block exits, the temporary directory and its contents are deleted. | def download_and_expand_tgz(url):
with TemporaryDirectory(prefix="cot_helper") as directory:
logger.debug("Temporary directory is %s", directory)
logger.verbose("Downloading and extracting %s", url)
response = requests.get(url, stream=True)
tgz = os.path.join(dire... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_cookbook(fileurl, download_dir):\n\n # download and save file to download_dir\n logger.info('Downloading cookbook: %s' % fileurl)\n \n # get filename\n tarname = fileurl.split('/')[-1].split('?')[0]\n tarfilepath = download_dir + tarname\n\n logger.info('Writing cookbook file to %s' % tarfilepa... | [
"0.62083673",
"0.6153068",
"0.61525756",
"0.61271447",
"0.6092888",
"0.60340095",
"0.59936154",
"0.5964651",
"0.5943424",
"0.5928815",
"0.5881789",
"0.5881151",
"0.5860098",
"0.5851195",
"0.58434874",
"0.58278465",
"0.5797649",
"0.5757592",
"0.57425237",
"0.5731297",
"0.56678... | 0.79323375 | 0 |
Copy the given src to the given dest, using sudo if needed. | def copy_file(src, dest):
logger.debug("Copying %s to %s", src, dest)
try:
shutil.copy(src, dest)
except (OSError, IOError) as exc:
logger.debug('Installation error, trying sudo.')
try:
check_call(['sudo', 'cp', src, dest])
except H... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cp(src, dest):\n _shutil.copy2(native(src), native(dest))",
"def cp(self, src, dest):\r\n return self._call(\"-cp\", src, dest, suppress_output=True)",
"def put(self, src, dst):\r\n abs_src = os.path.expanduser(src)\r\n assert os.path.exists(abs_src), 'File does not exist, cannot copy: %s' % ab... | [
"0.7202773",
"0.71418583",
"0.70746446",
"0.70545626",
"0.70545626",
"0.7038575",
"0.6986809",
"0.6972803",
"0.68632346",
"0.6799487",
"0.67680556",
"0.6762343",
"0.6698631",
"0.6684903",
"0.66698176",
"0.664158",
"0.66325283",
"0.6583825",
"0.655797",
"0.6556913",
"0.6548022... | 0.8034415 | 0 |
Install the requested package if needed. | def install_package(self, package):
raise NotImplementedError("install_package not implemented!") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _install(self):\n # Default implementation\n for pm_name, package in self._provider_package.items():\n if helpers[pm_name]:\n helpers[pm_name].install_package(package)\n return\n raise self.unsure_how_to_install()",
"def install(self) -> None:\n ... | [
"0.74971884",
"0.743103",
"0.72165495",
"0.72011894",
"0.7175178",
"0.71454424",
"0.7096459",
"0.709213",
"0.70829797",
"0.70747244",
"0.6999891",
"0.6971635",
"0.69083977",
"0.690607",
"0.6884969",
"0.68837327",
"0.68573093",
"0.6829712",
"0.6813082",
"0.68012875",
"0.678870... | 0.74461925 | 1 |
Select the first helper that is available from the given list. If no helper in the list is currently installed, will install the first installable helper from the list. | def helper_select(choices):
def _name_min_ver_from_choice(choice):
if isinstance(choice, str):
# Helper name only, no version constraints
name = choice
min_version = None
else:
# Tuple of (name, version)
(name, vers) = choice
mi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def androidCheckAndInstallHelper():\n\ttry:\n\t\tdevice_pkg_list = subprocess.Popen([\"adb\", \"shell\", \"pm\", \"list\", \"packages\"],stdout=subprocess.PIPE)\n\t\tif (sys.platform == 'win32'):\n\t\t\tstatus = subprocess.call([\"findstr\", glob_helper_id], stdin=device_pkg_list.stdout, stdout=stdout,stderr=stder... | [
"0.5426493",
"0.51149195",
"0.50774646",
"0.5073991",
"0.48588225",
"0.47693434",
"0.4701332",
"0.46194068",
"0.4600768",
"0.4591774",
"0.45914146",
"0.4589098",
"0.45755222",
"0.45493883",
"0.4528167",
"0.44857267",
"0.44755524",
"0.44556394",
"0.44522792",
"0.4443739",
"0.4... | 0.73460364 | 0 |
List Submarine CLI Config | def list_config():
console = Console()
_config = loadConfig()
json_data = richJSON.from_data({**asdict(_config)})
console.print(Panel(json_data, title="SubmarineCliConfig")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config(ctx):\n if not ctx.invoked_subcommand:\n cfg = ctx.obj['cfg']\n for section in cfg.sections():\n print(\"[\", section, \"]\")\n for option in cfg[section]:\n print(option, \" = \", cfg[section][option])",
"def test_config_list():\n client = Test... | [
"0.67605525",
"0.6507049",
"0.6401944",
"0.62840766",
"0.6266251",
"0.6222829",
"0.6218673",
"0.62083936",
"0.6117689",
"0.61028343",
"0.60979944",
"0.6047265",
"0.600282",
"0.59887755",
"0.5980506",
"0.59677553",
"0.5934213",
"0.5933008",
"0.5919896",
"0.5906206",
"0.588278"... | 0.8306971 | 0 |
Init Submarine CLI Config | def init_config():
try:
initConfig()
click.echo("Submarine CLI Config initialized")
except AttributeError as err:
click.echo(err) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure_cli(subparsers) -> None: # type: ignore\n parser = subparsers.add_parser(\n name='items',\n description='Retrieve new/updated items from Aleph and send to CaiaSoft'\n )\n parser.set_defaults(cmd_name='items')",
"def extend_cli(self, subparser):",
"def init():\n\n @click... | [
"0.67918545",
"0.677461",
"0.6760575",
"0.6316977",
"0.6305228",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"0.63049144",
"... | 0.83997005 | 0 |
receives employee and adds to his attendance the date from the computer | def mark_attendance(employee):
# loads date from computer
today = datetime.datetime.now()
mark = today.strftime("%d/%m/%Y %H:%M")
# adds to attendance list in object
employee.attendance.append(mark)
return employee.attendance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atten_date(list_emp, name, start_rep, end_rep):\r\n with open(\"attendance_log.txt\", \"w\") as attendance_by_emp:\r\n # writes new\\re writes attendance_log from the beginning\r\n attendance_by_emp.seek(0)\r\n attendance_by_emp.write(\"Employee Attendance Report %s-%s:\\n\" % (start_re... | [
"0.700645",
"0.6820274",
"0.6815842",
"0.6375137",
"0.5984329",
"0.5884957",
"0.58811086",
"0.5774172",
"0.5733743",
"0.57236177",
"0.5711324",
"0.5621928",
"0.5612466",
"0.54316646",
"0.54300493",
"0.5417493",
"0.54134583",
"0.54100406",
"0.5393978",
"0.5390573",
"0.5380051"... | 0.7452896 | 0 |
receives employees list and name of employee writes attendance log by the dates marked in employee attendance section from employee log | def atten_employee(list_emp, name):
with open("attendance_log.txt", "w") as attendance_by_emp:
attendance_by_emp.seek(0)
attendance_by_emp.write("Employee Attendance Report:\n")
for worker in list_emp:
if worker.name == name:
attendance_by_emp.write("%s-\n" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atten_date(list_emp, name, start_rep, end_rep):\r\n with open(\"attendance_log.txt\", \"w\") as attendance_by_emp:\r\n # writes new\\re writes attendance_log from the beginning\r\n attendance_by_emp.seek(0)\r\n attendance_by_emp.write(\"Employee Attendance Report %s-%s:\\n\" % (start_re... | [
"0.7998323",
"0.7200516",
"0.6942675",
"0.6927214",
"0.6889167",
"0.68515456",
"0.6224374",
"0.6184264",
"0.61136",
"0.6011102",
"0.5943537",
"0.59342873",
"0.5907207",
"0.5708407",
"0.5648311",
"0.5635953",
"0.553536",
"0.5468055",
"0.5378415",
"0.53584635",
"0.53344506",
... | 0.79087865 | 1 |
receives employees list and name of employee and dates for report writes attendance log by the dates marked in employee attendance section from employee log that are in between the dates given | def atten_date(list_emp, name, start_rep, end_rep):
with open("attendance_log.txt", "w") as attendance_by_emp:
# writes new\re writes attendance_log from the beginning
attendance_by_emp.seek(0)
attendance_by_emp.write("Employee Attendance Report %s-%s:\n" % (start_rep, end_rep))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atten_employee(list_emp, name):\r\n with open(\"attendance_log.txt\", \"w\") as attendance_by_emp:\r\n attendance_by_emp.seek(0)\r\n attendance_by_emp.write(\"Employee Attendance Report:\\n\")\r\n for worker in list_emp:\r\n if worker.name == name:\r\n attendan... | [
"0.7140298",
"0.70200807",
"0.6729821",
"0.6717611",
"0.64115995",
"0.64111805",
"0.62319225",
"0.62289315",
"0.613133",
"0.60454667",
"0.58585954",
"0.58535314",
"0.56137615",
"0.5603021",
"0.55985755",
"0.5597785",
"0.55474323",
"0.54905134",
"0.5477658",
"0.5460034",
"0.54... | 0.79304194 | 0 |
receives employees list and month to issue report writes attendance log by the dates marked in employee attendance section from employee log that are on the month given | def atten_month(list_emp, month):
count = 0
with open("attendance_log.txt", "w") as attendance_by_emp:
# writes new\re writes attendance_log from the beginning
attendance_by_emp.seek(0)
attendance_by_emp.write("Monthly Attendance Report:\n")
# for each worker
for w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atten_late(list_emp, month):\r\n count = 0\r\n with open(\"attendance_log.txt\", \"w\") as attendance_by_emp:\r\n # writes new\\re writes attendance_log from the beginning\r\n attendance_by_emp.seek(0)\r\n attendance_by_emp.write(\"Late Attendance Report:\\n\")\r\n for worker ... | [
"0.73222876",
"0.7028522",
"0.66604036",
"0.61002254",
"0.59888744",
"0.588432",
"0.58696795",
"0.58326685",
"0.5568624",
"0.55183697",
"0.5418106",
"0.5389267",
"0.53431535",
"0.5332585",
"0.53176826",
"0.5308479",
"0.52960485",
"0.5281457",
"0.52615917",
"0.5260086",
"0.523... | 0.77508336 | 0 |
reads latest report issued to attendance_log and makes list out of it by name of worker and dates | def read_rep():
import re
name = ''
date_list = []
attendance_list = []
with open("attendance_log.txt", "r+") as attendance_log:
# reads report from beginning
attendance_log.seek(0)
text = attendance_log.readline()
# reads till the end of file
while ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atten_date(list_emp, name, start_rep, end_rep):\r\n with open(\"attendance_log.txt\", \"w\") as attendance_by_emp:\r\n # writes new\\re writes attendance_log from the beginning\r\n attendance_by_emp.seek(0)\r\n attendance_by_emp.write(\"Employee Attendance Report %s-%s:\\n\" % (start_re... | [
"0.7344474",
"0.6429696",
"0.642316",
"0.6219918",
"0.60831845",
"0.5935174",
"0.58798003",
"0.574236",
"0.5658059",
"0.5580678",
"0.55702406",
"0.55387235",
"0.5483825",
"0.5460242",
"0.54392344",
"0.53903866",
"0.5374356",
"0.5370465",
"0.5319822",
"0.530976",
"0.5287735",
... | 0.7034095 | 1 |
get phrase with highest match in answer | def get_fuzzy_match(object, answer, threshold=80):
answer_phrase = generate_ngrams(answer)
if answer_phrase:
best_match = [fuzz.ratio(object, phr) for phr in answer_phrase]
if np.max(best_match)>threshold:
return np.max(best_match), answer_phrase[np.argmax(best_match)]
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_phrase(self, phrase):\n key = None\n match_phrase = None\n for key in self.get_key_list(phrase):\n if key in self.cls_phrases:\n match_phrase = key\n break\n \n if match_phrase == None:\n return None, key\n return self.get_most_common(self.cls_phrases[match_phras... | [
"0.66247725",
"0.6553777",
"0.65412146",
"0.6354167",
"0.6313876",
"0.6296371",
"0.6218927",
"0.62104535",
"0.6197131",
"0.61763",
"0.61534256",
"0.6132818",
"0.6132219",
"0.61142945",
"0.60957694",
"0.60941297",
"0.6062161",
"0.60291696",
"0.59870625",
"0.5982425",
"0.597700... | 0.69061214 | 0 |
Find control based on criteria passed in | def find_control(class_name = None,
class_name_re = None,
title = None,
title_re = None,
top_level_only = False,
visible_only = True,
enabled_only = False,
auto_id = None,
control_type... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FindControl(self, id):\r\n \r\n wnd = self.FindWindow(id)\r\n return wnd",
"def getControl(*args):",
"def getControl(*args):",
"def getControl(*args):",
"def getControl(*args):",
"def find(self, p):\n pass",
"def find(self, rules):\n for rule in rules:\n ... | [
"0.5822617",
"0.55805063",
"0.55805063",
"0.55805063",
"0.55805063",
"0.5270967",
"0.52612096",
"0.52361274",
"0.52319705",
"0.5196317",
"0.5104053",
"0.509136",
"0.5062715",
"0.50617546",
"0.50339323",
"0.50263524",
"0.49981326",
"0.4993686",
"0.498954",
"0.4969214",
"0.4965... | 0.67686635 | 0 |
Print information. The message will be displayed only when set in verbose mode | def print_info(message: str):
global verbose
if verbose:
print("%s%s%s" % (KYEL, message, KNRM)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _verbose(self,text):\n if self.verbose:\n print(text)",
"def info(self, message):\n if self.show_info:\n print(message)",
"def print_verbose(message:str):\n if params['verbose']:\n print(message)\n return",
"def vprint(msg):\n if defaults.verbose:\n ... | [
"0.79141504",
"0.78131634",
"0.78125",
"0.75492525",
"0.7518829",
"0.7508526",
"0.75002575",
"0.74660003",
"0.7430403",
"0.7316383",
"0.73041266",
"0.7284179",
"0.72498906",
"0.722669",
"0.72252494",
"0.72167796",
"0.7200381",
"0.7192533",
"0.7155038",
"0.7149439",
"0.7143927... | 0.8204991 | 0 |
Get wb entity from wikidata querying id | def get_wbentity(id: str, language: str) -> dict:
url = "%s?format=json&action=wbgetentities&ids=%s&languages=%s" % (WIKIDATA_URL, id, language)
# Perform request
print_debug("Sending GET %s" % url)
response = requests.get(url)
data = response.json()
print_debug("%s -> %d" % (url, response.statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetchwikidata(a_wid):\n\n sparql = SPARQLWrapper(\"https://query.wikidata.org/sparql\", 'natural_earth_name_localizer v1.1.1 (github.com/nvkelso/natural-earth-vector)')\n query_template = \"\"\"\n SELECT\n ?e ?i ?r ?population\n ?name_ar\n ?name_bn\n ?na... | [
"0.5944075",
"0.57617134",
"0.5590625",
"0.55695814",
"0.54250944",
"0.5416358",
"0.53694934",
"0.5341507",
"0.52814716",
"0.5268735",
"0.5240495",
"0.52355516",
"0.5225218",
"0.5179069",
"0.51587063",
"0.5158042",
"0.51429176",
"0.51184136",
"0.50786835",
"0.50615066",
"0.50... | 0.6409492 | 0 |
Given a human entity, gather its metadata | def process_human_entity(entity: dict, language: str) -> bool:
try:
claims = entity["claims"]
# Get ID
remote_id = entity["title"]
print("%s\t%s" % ("ID".ljust(16), remote_id))
# Get name from label
name = entity["labels"][language]["value"].lower()
print("%s\... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetMetadata(self):\n return self.dict['meta']",
"def metadata(self): # -> list[Unknown]:\n ...",
"def metadata(self): # -> list[Unknown]:\n ...",
"def metadata(self): # -> None:\n ...",
"def get_metadata(sf):\r\n data = {}\r\n all_describe = sf.describe()\r\n\r\n s_objs... | [
"0.63045365",
"0.6099472",
"0.6099472",
"0.60658383",
"0.6019442",
"0.5950256",
"0.5925596",
"0.5865884",
"0.5837842",
"0.5832989",
"0.5804331",
"0.577898",
"0.57528645",
"0.5716007",
"0.5700103",
"0.5668536",
"0.56659424",
"0.56618357",
"0.56609726",
"0.5650907",
"0.5625421"... | 0.63930434 | 0 |
Given a topic entity, gather its metadata | def process_topic_entity(entity: dict, language: str) -> bool:
try:
# Get ID
remote_id = entity["title"]
print("%s\t%s" % ("ID".ljust(16), remote_id))
# Get name from label
name = entity["labels"][language]["value"].lower()
print("%s\t%s" % ("name".ljust(16), name))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetMetadataUpdates(self, entity):\n return {}",
"def extract_metadata(self, msg, payload, text, part):\n\n if part.get_content_maintype() == \"image\":\n\n name = part.get_param(\"name\")\n subtype = part.get_content_subtype()\n\n self._add_name(msg, name)\n ... | [
"0.5937639",
"0.5532264",
"0.5528785",
"0.5516331",
"0.5490444",
"0.5456583",
"0.5447793",
"0.54265445",
"0.5356764",
"0.53178805",
"0.52924263",
"0.52825814",
"0.5270477",
"0.5265703",
"0.52620506",
"0.5250395",
"0.5223258",
"0.52149874",
"0.5211604",
"0.5201723",
"0.5197745... | 0.65928495 | 0 |
test max backprop for degeneratevalued tensors | def test_degenerate_max_back(fill_val, shape, num_axes, keepdims):
a = Tensor(np.full(shape=shape, fill_value=fill_val, dtype=float))
if num_axes == 0:
axes = None
else:
axes = tuple(np.random.choice(range(0, a.ndim), size=min(num_axes, a.ndim), replace=False))
out = a.max(axis=axes, k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_max_back(a, num_axes, keepdims):\n if num_axes == 0:\n axes = None\n else:\n axes = np.random.choice(range(0, a.ndim), size=min(num_axes, a.ndim), replace=False)\n axes = tuple(sorted(axes))\n\n # single global maximum\n if axes is None or axes == tuple(range(a.ndim)):\n ... | [
"0.70607835",
"0.6407941",
"0.638999",
"0.6385043",
"0.6329985",
"0.62201446",
"0.6184464",
"0.61764807",
"0.61694896",
"0.6146497",
"0.6138748",
"0.61347914",
"0.6126467",
"0.61081934",
"0.6097244",
"0.60828453",
"0.6068627",
"0.605248",
"0.60262644",
"0.5993944",
"0.5957129... | 0.6576286 | 1 |
Test Tensor.max for arbitrary data, axis, and keepdim | def test_max_back(a, num_axes, keepdims):
if num_axes == 0:
axes = None
else:
axes = np.random.choice(range(0, a.ndim), size=min(num_axes, a.ndim), replace=False)
axes = tuple(sorted(axes))
# single global maximum
if axes is None or axes == tuple(range(a.ndim)):
index = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max(tensor, axis=None):\n raise NotImplementedError",
"def dim_zero_max(x: Tensor) ->Tensor:\n return torch.max(x, dim=0).values",
"def masked_maximum(data, mask, dim=1):\n axis_minimums = tf.reduce_min(data, dim, keepdims=True)\n masked_maximums = tf.reduce_max(\n tf.math.multiply(data - ... | [
"0.72939914",
"0.7249118",
"0.7159474",
"0.69270927",
"0.6816063",
"0.6693305",
"0.6689232",
"0.66115314",
"0.6510889",
"0.64802194",
"0.6467747",
"0.6454342",
"0.64498174",
"0.6414373",
"0.6373469",
"0.6357863",
"0.6347594",
"0.62862027",
"0.62368566",
"0.6203899",
"0.618134... | 0.7470672 | 0 |
Returns accuracy. top_k is a dict as returned by get_top_k(). | def get_accuracy(top_k):
n_correct = [(question in paragraphs) for question, paragraphs in top_k.items()]
accuracy = sum(n_correct)/len(top_k)*100
return accuracy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accuracy(output, target, topk=(1,)):\n\tmaxk = max(topk)\n\tbatch_size = target.size(0)\n\n\t_, pred = output.topk(maxk, 1, True, True)\n\tpred = pred.t()\n\tcorrect = pred.eq(target.view(1, -1).expand_as(pred))\n\n\tres = []\n\tfor k in topk:\n\t\tcorrect_k = correct[:k].view(-1).float().sum(0)\n\t\tres.appen... | [
"0.7790706",
"0.76820815",
"0.7681787",
"0.7681787",
"0.76809895",
"0.76707727",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
"0.76609564",
... | 0.78114355 | 0 |
Returns a similarity matrix based on the distance in the BERT encoded space | def get_BERT_similarity(questions, paragraphs):
E_Q = encoder_BERT(tokenize_BERT(questions))
E_P = encoder_BERT(tokenize_BERT(paragraphs))
sim = torch.matmul(E_Q, E_P.T)
return sim.numpy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_alphabet_similarity_matrix(self):\n distance_matrix = numpy.zeros((len(self.alphabet), len(self.alphabet)))\n numpy.fill_diagonal(distance_matrix, 0)\n for index_one, descriptor_one in enumerate(self.descriptors):\n for index_two, descriptor_two in enumerate(self.descriptors... | [
"0.66499",
"0.65301746",
"0.6433646",
"0.63954276",
"0.6269463",
"0.62338036",
"0.6221398",
"0.59974766",
"0.59818846",
"0.5971752",
"0.5964495",
"0.5939761",
"0.5911692",
"0.5887766",
"0.58849543",
"0.5881551",
"0.5879212",
"0.58343947",
"0.5831166",
"0.5803444",
"0.5802531"... | 0.6625734 | 1 |
find the process id for a currently running sl robot | def get_process_pid(robot_name):
try:
result = check_output(['pgrep', 'x{0}'.format(robot_name)])
return int(result.strip())
except:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findRobot(self):\n rpid = self.robot['SCRIPTOBS_PID'].read(binary=True)\n if rpid == '' or rpid == -1:\n return rpid, False\n else:\n return rpid, True",
"def pid(self):\n return self._get_process_id()",
"def pid(self):\n return self._process.pid",
... | [
"0.7184294",
"0.70063066",
"0.6918346",
"0.68940526",
"0.68393856",
"0.6833147",
"0.68222165",
"0.68222165",
"0.6774008",
"0.6773823",
"0.66580254",
"0.66330874",
"0.66211843",
"0.6592329",
"0.65899223",
"0.65460473",
"0.6543906",
"0.6522143",
"0.6512451",
"0.6485684",
"0.648... | 0.7494917 | 0 |
get the key for a semaphore from its name string | def get_semaphore_key(name, pid):
key = pid
for i in range(0, len(name)):
key += i * 100 + ord(name[i])
return key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_name(name):\n return 'hotqueue:%s' % name",
"def key(self, name):\n return name",
"def get_key (self, name):\n return self + name",
"def get_key(command):\n return command.split(\" \")[1]",
"def get_semaphore(name, pid, time_out=None, pause=0.1):\n\n semaphore_key = get_semap... | [
"0.6847973",
"0.6292527",
"0.6194449",
"0.61509615",
"0.60495234",
"0.5931849",
"0.58276147",
"0.5797285",
"0.57859164",
"0.57077163",
"0.5702789",
"0.5633537",
"0.5573347",
"0.5567078",
"0.556155",
"0.55567104",
"0.5537676",
"0.5537567",
"0.55212706",
"0.5498159",
"0.5483031... | 0.8225145 | 0 |
get semaphore by name, will wait until time out (default forever) | def get_semaphore(name, pid, time_out=None, pause=0.1):
semaphore_key = get_semaphore_key(name, pid)
while True:
try:
return Semaphore(semaphore_key)
except ExistentialError:
sleep(pause)
if time_out is not None:
time_out -= pause
if tim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_semaphore(value: int, *, max_value: Optional[int] = None) -> Semaphore:\n return Semaphore(value, max_value=max_value)",
"def get_named_lock(self, name):\r\n # Global critical section\r\n self._named_locks_lock.acquire()\r\n if not name in self._named_locks:\r\n self... | [
"0.65372044",
"0.6336534",
"0.5851215",
"0.57648456",
"0.56086",
"0.54871815",
"0.5442807",
"0.54296815",
"0.53948087",
"0.53905845",
"0.5327502",
"0.53029823",
"0.52965593",
"0.52278167",
"0.52278167",
"0.52278167",
"0.52278167",
"0.52278167",
"0.52278167",
"0.52278167",
"0.... | 0.8428689 | 0 |
confirm if semaphore exists by key | def check_semaphore(semaphore_key):
if isinstance(semaphore_key, str):
semaphore_key = eval(semaphore_key)
keys = [eval(sem['key']) for sem in list_semaphores()]
return semaphore_key in keys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _exists(self, key):\n return await self.client.append(key, b'')",
"async def _exists(self, key):\n return key in SimpleMemoryBackend._cache",
"async def _exists(self, key):\n with await self._connect() as redis:\n exists = await redis.exists(key)\n return Tr... | [
"0.6077598",
"0.56487805",
"0.5642792",
"0.55564326",
"0.5552635",
"0.54773825",
"0.5448091",
"0.53684866",
"0.5338153",
"0.5331036",
"0.53079194",
"0.52312565",
"0.5218793",
"0.5186466",
"0.5185847",
"0.5177458",
"0.5174624",
"0.5164349",
"0.51480573",
"0.5147692",
"0.514037... | 0.67000616 | 0 |
Update self.Designs to reflect the files read from designfiles. | def updateDesigns(self, designfilenames):
self.Designs = [Design(filename) for filename in designfilenames]
self.parseDesigns()
return self.Designs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadDesign(self, file):\n\n\t\tloadInterfaceDesign(file, \"designed\")\n\t\tself.setDesign(file)",
"def compareDesigns(self):\n if len(self.Designs) < 2:\n print(\"compareDesigns() ERROR: self.Designs < 2 - aborting !\")\n return\n # Finished parsing the designs, let's do ... | [
"0.6469966",
"0.6421716",
"0.6351114",
"0.60728395",
"0.57806355",
"0.5699185",
"0.566477",
"0.5605553",
"0.56018734",
"0.5581749",
"0.55297726",
"0.5515195",
"0.54666984",
"0.54063374",
"0.53756565",
"0.5367712",
"0.5367688",
"0.53272086",
"0.52968115",
"0.52732944",
"0.5270... | 0.81200063 | 0 |
Parse all designs given by . If no design arg is provided, parses self.Designs. | def parseDesigns(self, designs=None):
if designs is None:
designs = self.Designs
for design in designs:
# code moved to design, where it is more logically placed in OOP.
design.parse_csvfile()
#designfilename = design.Filename | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_design(self, detailed_design_file):",
"def read_design(designfile):\r\n designtype = None\r\n if re.search(r\"\\.adm$\", designfile, flags=re.I) is not None:\r\n designtype = XMLDesign\r\n elif re.search(r\"\\.xml$\", designfile, flags=re.I) is not None:\r\n designtype = XMLDesig... | [
"0.64113116",
"0.62336487",
"0.61886126",
"0.6175259",
"0.5514318",
"0.51723",
"0.5144108",
"0.5093292",
"0.50356483",
"0.50114316",
"0.4921483",
"0.49180877",
"0.4912562",
"0.4908794",
"0.4887319",
"0.4843397",
"0.48201686",
"0.48197335",
"0.47855583",
"0.477554",
"0.4687779... | 0.80440956 | 0 |
Compares self.Designs[0] against self.Designs[1]. | def compareDesigns(self):
if len(self.Designs) < 2:
print("compareDesigns() ERROR: self.Designs < 2 - aborting !")
return
# Finished parsing the designs, let's do some initial comparison:
print(self.Designs)
self.DesignsetIntersection = self.Designs[0].Designset &... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateDesigns(self, designfilenames):\n self.Designs = [Design(filename) for filename in designfilenames]\n self.parseDesigns()\n return self.Designs",
"def compareDesignVsOligosOld(self, db_oligos, designs=None):\n if designs is None:\n designs = self.Designs\n\n ... | [
"0.6152954",
"0.60208225",
"0.5540495",
"0.54212826",
"0.5381174",
"0.52781886",
"0.5191074",
"0.51623356",
"0.51623356",
"0.49850598",
"0.49516216",
"0.4940581",
"0.4912433",
"0.4906158",
"0.48863208",
"0.48672363",
"0.48671553",
"0.4858016",
"0.48538524",
"0.4843606",
"0.48... | 0.81460935 | 0 |
Compare a design in self.Designs against rackfiles. If rackfiles are not given, glob the current directory after .rack.csv files. If designfilenames are not given, use designs in self.Designs. If these are not found either, then glob for .smmc files. | def compareDesignVsRackfiles(self, designfilenames=None, rackfilenames=None):
# 1) READ RACK DATA and make oligo_racks DATASTRUCTURE:
# Copy/paste a lot from epmotion_staplemixer:
if rackfilenames is None:
ext = ".rack.csv"
#rackfilenames = [fname for fname in os.listdir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_matches(self, filename):\n sofar = (((\"observatory\", self.observatory),\n (\"instrument\",self.instrument),\n (\"filekind\", self.filekind),),)\n return sorted(self.selector.file_matches(filename, sofar))",
"def parseDesigns(self, designs=None):\n ... | [
"0.5605248",
"0.5564108",
"0.5333899",
"0.5222126",
"0.5114063",
"0.5098187",
"0.50271696",
"0.49226967",
"0.4900991",
"0.48933142",
"0.4842557",
"0.4835842",
"0.47889137",
"0.4752677",
"0.47054994",
"0.4684729",
"0.46719956",
"0.46683034",
"0.46680823",
"0.46640804",
"0.4640... | 0.7222595 | 0 |
From epmotion_staplemixer.py Used to select a particular candidate determined from a hint, e.g. hint "seq" will find "Sequence" in candidates ("Rack","Sequence","Start") | def findFieldByHint(self, candidates, hints):
if not isinstance(hints, (list, tuple)):
hints = (hints,)
for hint in hints:
for candidate in candidates:
if hint in candidate.lower():
return candidate
# None of the hints were found in eit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _candidates(self, token):",
"def search(search, candidates):\n choicer = choices.Choice()\n for candidate in candidates:\n choicer.add(candidate)\n return choicer.search(search)",
"def suggestion(self):\n raise NotImplementedError()",
"def candidates(word):\r\n return (known([wo... | [
"0.61352617",
"0.5960104",
"0.5867481",
"0.583121",
"0.5544083",
"0.5451395",
"0.5438957",
"0.5372487",
"0.5328611",
"0.530819",
"0.5308054",
"0.5298499",
"0.5285938",
"0.5283041",
"0.52671033",
"0.52489936",
"0.5201587",
"0.51973087",
"0.5197184",
"0.5176356",
"0.5169144",
... | 0.6759677 | 0 |
Plot historic load with indication of train/test/validation periods | def plot_historic_with_sets(historic_data, periods):
fig = (
historic_data[["load"]]
.dropna()
.iplot(
asFigure=True,
layout=dict(
xaxis=dict(title=""),
yaxis=dict(title="Belasting [MW?]"),
margin=dict(b=0, t=0, l=0, r=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_train_history(self):\n plt.figure()\n plt.xlabel('Epochs')\n plt.ylabel('Loss')\n plt.plot(self.train_history.history['loss'])\n plt.plot(self.train_history.history['val_loss'])\n plt.legend(['Training', 'Validation'])\n\n plt.show()",
"def plots(self, hi... | [
"0.6691437",
"0.6671853",
"0.66687286",
"0.66334623",
"0.6574698",
"0.6527699",
"0.6480634",
"0.6478527",
"0.64323837",
"0.63800144",
"0.63595504",
"0.6352296",
"0.6301344",
"0.62618",
"0.6254833",
"0.6242475",
"0.6211541",
"0.618207",
"0.6179336",
"0.6154083",
"0.61485445",
... | 0.6683892 | 1 |
Plot typical profile for weekday / weekendday Note, this does not make much sense for windpower | def plot_typical_day(bdf):
bdf["time"] = bdf.index.time
bdf["weekday"] = bdf.index.weekday < 5
week_profile = bdf[bdf.weekday].pivot_table(
index="time", values="load", aggfunc=["mean", "max", "min"]
)
week_profile.columns = ["week_mean", "week_max", "week_min"]
weekend_profile = bdf[~b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_powerlaw_output(timeDB, xunits='yr', yunits='MPa', skip=8, P0=33.0):",
"def hr_report():\n\n # Load the peak data.\n db = Persistence()\n if not (activities := db.load_all()):\n print(\"No data to report on\")\n return\n\n # Find the maximum for each value.\n max = _load_max... | [
"0.57431346",
"0.5622101",
"0.5619609",
"0.5508879",
"0.5471546",
"0.5386438",
"0.5343684",
"0.5334588",
"0.5234261",
"0.5214478",
"0.52023536",
"0.51653636",
"0.5144277",
"0.5143536",
"0.5114244",
"0.5086622",
"0.5084803",
"0.5076106",
"0.50429946",
"0.50367105",
"0.5030665"... | 0.7545101 | 0 |
Calculates amount of congestion mitigation. This fucntion asumes congestion mitigation is always applied when the forecasts exceeds the congestion limit. | def calculate_amount_congestion_mitigation(
forecast_mw: pd.Series, congestion_limit_mw: float
) -> pd.Series:
# Depending on the sign of the congestion limit apply a different calculation
if np.sign(congestion_limit_mw) == 1: # In case of a positive congestion limit
return np.abs(np.maximum(forec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overall_reduction(self):\n return 84",
"def calculate_reduced_congestion(\n congestion_before_mitigation_mw: pd.Series,\n congestion_after_mitigation_mw: pd.Series,\n) -> pd.Series:\n return congestion_before_mitigation_mw.abs() - congestion_after_mitigation_mw.abs()",
"def calculate_missed... | [
"0.63037133",
"0.61761236",
"0.6077708",
"0.59612787",
"0.59200746",
"0.55369604",
"0.5527582",
"0.5480383",
"0.54655176",
"0.5442943",
"0.5421746",
"0.53828466",
"0.53550106",
"0.5344298",
"0.53154397",
"0.53140706",
"0.5300549",
"0.52831197",
"0.5280425",
"0.5255623",
"0.52... | 0.7088901 | 0 |
Calculates how much congestion is reduced after applying the mitigation | def calculate_reduced_congestion(
congestion_before_mitigation_mw: pd.Series,
congestion_after_mitigation_mw: pd.Series,
) -> pd.Series:
return congestion_before_mitigation_mw.abs() - congestion_after_mitigation_mw.abs() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overall_reduction(self):\n return 84",
"def calc_reduction_diesel_used (self):\n self.reduction_diesel_used = self.diesel_equiv_captured - \\\n self.loss_heat_recovery\n #~ print 'self.reduction_diesel_used',self.reduction_diesel_used",
"def handle_c... | [
"0.7050122",
"0.62378347",
"0.6099742",
"0.6095235",
"0.57979983",
"0.57294005",
"0.5707247",
"0.56071997",
"0.5603209",
"0.5545916",
"0.5545641",
"0.55037445",
"0.54971516",
"0.54971516",
"0.54876506",
"0.54754734",
"0.54083735",
"0.5404089",
"0.5390943",
"0.5386935",
"0.538... | 0.6472594 | 1 |
Calculates how much congestion is missed after applying the mitigation | def calculate_missed_congestion(congestion_after_mitigation_mw: pd.Series) -> pd.Series:
return congestion_after_mitigation_mw.abs() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overall_reduction(self):\n return 84",
"def calculate_reduced_congestion(\n congestion_before_mitigation_mw: pd.Series,\n congestion_after_mitigation_mw: pd.Series,\n) -> pd.Series:\n return congestion_before_mitigation_mw.abs() - congestion_after_mitigation_mw.abs()",
"def calc_reduction_d... | [
"0.60898376",
"0.60835487",
"0.59932685",
"0.59013355",
"0.57387525",
"0.5733132",
"0.5612843",
"0.56021935",
"0.56021935",
"0.56021935",
"0.5592352",
"0.55818313",
"0.5523213",
"0.55115414",
"0.548725",
"0.5405025",
"0.53899837",
"0.53870213",
"0.5374428",
"0.5373917",
"0.53... | 0.6758142 | 0 |
Adds a key to the hash table. | def add(self, key):
addition_idx = self._reduce(self._hash(key))
if self.table[addition_idx] != "_":
# collision
new_idx = self._resolve_collision(addition_idx)
if new_idx == addition_idx:
# table is full; do not insert
print("Did not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addKey(self, key, val):\n self.dict[key].append(val)",
"def add(self, key, value):\n if not key in self:\n self.keys.append(key)\n self.dict[key] = value",
"def insert(self, key):\r\n index = self.search(key)\r\n self.keys.insert(index, key)",
"def add(se... | [
"0.7685243",
"0.7539673",
"0.73911446",
"0.7281249",
"0.7185905",
"0.71375227",
"0.711882",
"0.7110316",
"0.709156",
"0.70903313",
"0.70279557",
"0.69707227",
"0.6967126",
"0.68985003",
"0.68930984",
"0.68813497",
"0.68723124",
"0.6863825",
"0.6838719",
"0.68136096",
"0.68052... | 0.8220304 | 0 |
Wraps a given Keras layer baseclass, adding Runtime Weight Scaling in the `build()` method using the constant from the He initializer. | def WeightScaled(
layer_base_class: Type[tf.keras.layers.Layer],
kernel_attr: str = "kernel",
kernel_initializer_attr: str = "kernel_initializer",
):
class WeightScaledVariant(layer_base_class):
def __init__(self, gain: float = 2.0, fan_in: int = None, *args, **kwargs):
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(self, input_shape):\n if self.use_scale:\n self.scale = self.add_weight(\n name='scale',\n shape=(),\n initializer='ones',\n dtype=self.dtype,\n trainable=True)\n else:\n self.scale = None\n super(HypLuongAttention, self).build(input_shape)"... | [
"0.68051386",
"0.66374505",
"0.64986295",
"0.63973767",
"0.61030334",
"0.6087606",
"0.60452276",
"0.6027698",
"0.6001209",
"0.5969962",
"0.5932495",
"0.58896536",
"0.5828722",
"0.58136284",
"0.58035344",
"0.57821167",
"0.5771482",
"0.5746343",
"0.57364935",
"0.5716917",
"0.57... | 0.796408 | 0 |
Split an heroku syslog encoded payload using the octet counting | def split(self, bytes):
# '''Split by lines heroku payload and apply filters.'''
# lines = []
lines = []
while len(bytes) > 0:
# find first space character
i = 0
while bytes[i] != 32: # 32 is white space in unicode
i += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_recvd_data(data):\n parts = data.split(b'\\0')\n msgs = parts[:-1]\n rest = parts[-1]\n return (msgs, rest)",
"def get_payload(raw_msg):\n\n return raw_msg[14:-6], raw_msg[-5]",
"def test_syslog_ng_priofield_bug_2132(self):\n transformer = SplitTransformer()\n transformer.setup(\... | [
"0.5825221",
"0.5779017",
"0.5746839",
"0.5741012",
"0.5733622",
"0.5695628",
"0.5643104",
"0.550842",
"0.54955804",
"0.53063726",
"0.52619374",
"0.5243628",
"0.52134186",
"0.51951015",
"0.51725113",
"0.5168",
"0.5146507",
"0.51151645",
"0.5106427",
"0.5085364",
"0.5029942",
... | 0.6384513 | 0 |
Will update ranking result weights based on relevance feedback from user. | def update_weights_rocchio(isRelevant, result):
global global_weights
max_contributing_weight = max(result.sim_measures, key=result.sim_measures.get)
if isRelevant:
global_weights[max_contributing_weight] += alpha
for measure in result.sim_measures:
global_weights[measure] -= beta
else:
global_weights[ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, rank):\n # calculate MR and MRR\n self.mr += rank\n self.mrr += 1 / rank\n # calculate Hits@k\n if rank <= 1:\n self.hits1 += 1\n self.hits3 += 1\n self.hits5 += 1\n self.hits10 += 1\n elif rank <= 3:\n ... | [
"0.6656293",
"0.6414288",
"0.6385047",
"0.62573546",
"0.6228324",
"0.62062085",
"0.6174465",
"0.6155069",
"0.60976714",
"0.6079026",
"0.6010616",
"0.5998213",
"0.5985178",
"0.5975957",
"0.5956633",
"0.59447515",
"0.59426117",
"0.5934645",
"0.5927816",
"0.5911735",
"0.5911735"... | 0.6478664 | 1 |
Representation string consisting of all schedule policies of the commcell. | def __str__(self):
representation_string = '{:^5}\t{:^20}\n\n'.format('S. No.', 'Schedule Policy')
for index, policy in enumerate(self._policies):
sub_str = '{:^5}\t{:20}\n'.format(index + 1, policy)
representation_string += sub_str
return representation_string.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return \"SchedulePolicies class instance for Commcell: '{0}'\".format(\n self._commcell_object.commserv_name\n )",
"def __str__(self):\n schedule = \"\"\n\n schedule_list = self.in_order_traversal()\n for node in schedule_list:\n sche... | [
"0.7528753",
"0.6522689",
"0.6413424",
"0.64105564",
"0.63962394",
"0.6315614",
"0.6294084",
"0.6177894",
"0.59969956",
"0.5982622",
"0.5968384",
"0.5962794",
"0.58488005",
"0.5839217",
"0.58239543",
"0.5819081",
"0.5814189",
"0.5749863",
"0.57404006",
"0.57089245",
"0.570570... | 0.7998539 | 0 |
Returns the schedule policies on this commcell dict consists of all schedule policies of the commcell { | def all_schedule_policies(self):
return self._policies | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_schedule_policy_properties(self):\n flag, response = self._commcell_object._cvpysdk_object.make_request(\n 'GET', self._SCHEDULE_POLICY)\n\n if flag:\n if response.json() and 'taskInfo' in response.json():\n _task_info = response.json()['taskInfo']\n\n ... | [
"0.74400383",
"0.7169249",
"0.7169249",
"0.7169249",
"0.70043945",
"0.6431618",
"0.6236863",
"0.615473",
"0.61167574",
"0.5956318",
"0.59557253",
"0.58576393",
"0.5839012",
"0.57993275",
"0.57777995",
"0.57524997",
"0.5732555",
"0.5732555",
"0.5732555",
"0.5732555",
"0.573255... | 0.73879516 | 1 |
Checks if a schedule policy exists in the commcell with the input schedule policy name. | def has_policy(self, policy_name):
if not isinstance(policy_name, basestring):
raise SDKException('Storage', '101')
return self._policies and policy_name.lower() in self._policies | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_exist(self, schedule_name):\r\n schedule = self.find(\"schedules\", schedule_name, attribute=\"name\")\r\n if schedule is not None:\r\n return True\r\n else:\r\n return False",
"def get(self, schedule_policy_name, schedule_policy_id=None):\n\n if sch... | [
"0.6897822",
"0.5807715",
"0.54997754",
"0.5341511",
"0.5280394",
"0.5165808",
"0.51066023",
"0.50794977",
"0.50062746",
"0.49985325",
"0.4972901",
"0.4972901",
"0.49690324",
"0.49610734",
"0.49460763",
"0.4936861",
"0.492205",
"0.4898494",
"0.48891667",
"0.48678115",
"0.4819... | 0.6021162 | 1 |
gets the subtask in schedule policy JSON | def subtasks_json(policy_type):
_backup_subtask = {
"subTaskType": SchedulePolicies.policy_to_subtask_map[policy_type][0],
"operationType": SchedulePolicies.policy_to_subtask_map[policy_type][1]
}
return _backup_subtask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_json(policy_type, schedule_dict):\n schedule_options = ScheduleOptions(ScheduleOptions.policy_to_options_map[policy_type]\n ).options_json(schedule_dict.get('options', None))\n sub_task = SchedulePolicies.subtasks_json(policy_type)\n sub_t... | [
"0.6908057",
"0.6623224",
"0.61025584",
"0.6096736",
"0.6095517",
"0.5929616",
"0.57385856",
"0.5704319",
"0.5696931",
"0.5652136",
"0.5651372",
"0.5615915",
"0.5613843",
"0.5596496",
"0.55155903",
"0.55002975",
"0.5464961",
"0.54587245",
"0.54576206",
"0.54358786",
"0.541988... | 0.69764 | 0 |
Returns the schedule json for the given schedule options and pattern | def schedule_json(policy_type, schedule_dict):
schedule_options = ScheduleOptions(ScheduleOptions.policy_to_options_map[policy_type]
).options_json(schedule_dict.get('options', None))
sub_task = SchedulePolicies.subtasks_json(policy_type)
sub_task['subT... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_json(self) -> Optional[Dict]:\n if not self.schedule:\n return None\n else:\n start_time = conv_to_schedule(\n self.start_time if self.start_time else datetime.now()\n )\n end_time = conv_to_schedule(\n self.end_ti... | [
"0.69714135",
"0.6608115",
"0.6490676",
"0.62902755",
"0.60853785",
"0.5987964",
"0.5859467",
"0.5788064",
"0.57074827",
"0.566928",
"0.566735",
"0.55324644",
"0.5525637",
"0.55224836",
"0.5490654",
"0.54850155",
"0.5438549",
"0.5397229",
"0.53919643",
"0.5370622",
"0.5363592... | 0.7029603 | 0 |
Returns a schedule policy object of the specified schedule policy name. | def get(self, schedule_policy_name, schedule_policy_id=None):
if schedule_policy_name and not isinstance(schedule_policy_name, basestring):
raise SDKException('Schedules', '102')
if schedule_policy_id and not isinstance(schedule_policy_id, int):
raise SDKException('Schedules', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schedule(self, name):\n return self.__schedules.get(name, None)",
"def _get_scheduler_policy(self):\n return self.__scheduler_policy",
"def _get_scheduler_policy(self):\n return self.__scheduler_policy",
"def _get_scheduler_policy(self):\n return self.__scheduler_policy",
"def _get_... | [
"0.6700762",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.62134594",
"0.6182103",
"0.6173136",
"0.60809577",
"0.60009354",
"0.5817689",
"0.578083",
"0.5760546",
"0.5760257",
"0.5720774",
"0.56081015",
"0.56... | 0.77740514 | 0 |
deletes the specified schedule policy name. | def delete(self, schedule_policy_name):
if schedule_policy_name and not isinstance(schedule_policy_name, basestring):
raise SDKException('Schedules', '102')
schedule_policy_name = schedule_policy_name.lower()
schedule_policy_id = self.all_schedule_policies.get(schedule_policy_name)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, policy_name):\n path = self.vault.normalize(\"/sys/policies/acl/\" + policy_name)\n address = self.vault.vault_adress + \"/v1\" + path\n # Actually run vault\n logging.info(\"Deleting the policy: %s\", address)\n self.vault.requests_request(\"DELETE\", address, h... | [
"0.73713815",
"0.6725781",
"0.65186775",
"0.6503778",
"0.6147028",
"0.6134383",
"0.59893423",
"0.5983816",
"0.5982584",
"0.5963154",
"0.5947694",
"0.5876094",
"0.58747303",
"0.5853453",
"0.5822403",
"0.5817146",
"0.5754827",
"0.5754827",
"0.5731743",
"0.57026607",
"0.5685347"... | 0.7921951 | 0 |
Refresh the Schedule Policies associated with the Commcell. | def refresh(self):
self._policies = self._get_policies() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh(self):\n self._get_schedule_policy_properties()",
"def _modify_schedule_policy_properties(self):\n request_json = {\n 'taskInfo':\n {\n 'taskOperation': 1,\n 'associations': self._associations,\n 'task': ... | [
"0.7236242",
"0.6194222",
"0.59639466",
"0.578873",
"0.5538204",
"0.54793644",
"0.5470606",
"0.54116994",
"0.5321707",
"0.52480334",
"0.5215048",
"0.5213776",
"0.52024984",
"0.514748",
"0.51461214",
"0.51357204",
"0.50995845",
"0.5067136",
"0.5065873",
"0.5065873",
"0.5065873... | 0.63687164 | 1 |
Initialise the Schedule Policy class instance. | def __init__(self, commcell_obj, schedule_policy_name, schedule_policy_id=None):
self._commcell_object = commcell_obj
self.schedule_policy_name = schedule_policy_name
if schedule_policy_id:
self.schedule_policy_id = schedule_policy_id
else:
self.schedule_policy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,\n continuous_schedule=None,\n daily_schedule=None,\n monthly_schedule=None,\n periodicity=None,\n rpo_schedule=None,\n ):\n\n # Initialize members of the class\n self.continuous_schedule = co... | [
"0.65381724",
"0.63505894",
"0.6279018",
"0.6279018",
"0.6274582",
"0.61355",
"0.6133458",
"0.6129055",
"0.6119965",
"0.60912055",
"0.60786664",
"0.60656494",
"0.60447276",
"0.60314065",
"0.6027025",
"0.60074484",
"0.59940934",
"0.5987242",
"0.5974738",
"0.5973387",
"0.596291... | 0.64974314 | 1 |
Gets a schedule ID of the schedule policy Returns (int) schedule policy ID | def _get_schedule_policy_id(self):
schedule_policies = SchedulePolicies(self._commcell_object)
return schedule_policies.get(self.schedule_policy_name).schedule_policy_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"schedule_id\")",
"def policy_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"policy_id\")",
"def policy_id(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"policy_id\")",
"def security_po... | [
"0.7265618",
"0.6918219",
"0.69093806",
"0.68377894",
"0.68377894",
"0.68124413",
"0.6732101",
"0.67213774",
"0.6460177",
"0.6395417",
"0.6364246",
"0.6310633",
"0.6231959",
"0.62063766",
"0.62063766",
"0.62063766",
"0.62063766",
"0.62063766",
"0.62063766",
"0.62063766",
"0.6... | 0.8840227 | 0 |
Get the policy Type of the schedule policy | def policy_type(self):
return (
list(
SchedulePolicies.policy_types.keys())[
list(
SchedulePolicies.policy_types.values()).index(self._task_json['policyType'])]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_type(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"policy_type\")",
"def policy_type(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"policy_type\")",
"def policy_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"policy_type\")",
"def typ... | [
"0.7936323",
"0.78493845",
"0.78021806",
"0.71529824",
"0.6958368",
"0.68767196",
"0.68596804",
"0.66903925",
"0.66903925",
"0.66903925",
"0.6630274",
"0.6630274",
"0.6550651",
"0.6438638",
"0.6438638",
"0.6438638",
"0.6326373",
"0.6326373",
"0.6326373",
"0.6326373",
"0.63263... | 0.8559941 | 0 |
Gets the properties of this Schedule Policy. | def _get_schedule_policy_properties(self):
flag, response = self._commcell_object._cvpysdk_object.make_request(
'GET', self._SCHEDULE_POLICY)
if flag:
if response.json() and 'taskInfo' in response.json():
_task_info = response.json()['taskInfo']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def policy_assignment_properties(self) -> pulumi.Output['outputs.PolicyAssignmentPropertiesResponse']:\n return pulumi.get(self, \"policy_assignment_properties\")",
"def all_schedule_policies(self):\n return self._policies",
"def properties(self) -> Any:\n return pulumi.get(self, \"propert... | [
"0.7142913",
"0.71269935",
"0.6974034",
"0.6832099",
"0.67995626",
"0.6751171",
"0.6751171",
"0.6751171",
"0.6700777",
"0.665816",
"0.665816",
"0.6599557",
"0.6535393",
"0.65152854",
"0.64519536",
"0.64476055",
"0.6402394",
"0.6395917",
"0.6390834",
"0.6373602",
"0.6315861",
... | 0.8082696 | 0 |
Updates the schedule pattern for the provided schedule id (internal function) | def _update_pattern(self, schedule_id, pattern_dict):
existing_pattern = {}
for subtask in self._subtasks:
if subtask["subTask"]["subTaskId"] == schedule_id:
if 'pattern' in subtask:
existing_pattern = subtask['pattern']
if 'options' in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_schedule(self, schedule_json, schedule_id=None, schedule_name=None):\n sub_task = self.get_schedule(schedule_id, schedule_name)\n if not sub_task:\n raise SDKException('Schedules', '105')\n if 'pattern' in schedule_json:\n self._update_pattern(sub_task[\"subTas... | [
"0.6744926",
"0.6412104",
"0.62120795",
"0.61705697",
"0.613141",
"0.60556555",
"0.59785986",
"0.5877456",
"0.5838817",
"0.5838817",
"0.57718635",
"0.5762913",
"0.5749271",
"0.5734234",
"0.57116216",
"0.56752044",
"0.56241125",
"0.56052935",
"0.5591538",
"0.557645",
"0.556456... | 0.79783064 | 0 |
Updates the option for the provided schedule id (internal) | def _update_option(self, schedule_id, options):
option_allowed = ScheduleOptions.policy_to_options_map[self.policy_type]
for subtask in self._subtasks:
if subtask["subTask"]["subTaskId"] == schedule_id:
if 'options' in subtask:
existing_options = self.get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def svn_info_t_schedule_set(svn_info_t_self, svn_wc_schedule_t_schedule): # real signature unknown; restored from __doc__\n pass",
"def set_manual_schedule(self, connector_id):\n endpoint = self.api_path_connectors + connector_id\n return self._do_api_call(\n (\"PATCH\", endpoint),\n ... | [
"0.6042768",
"0.59424305",
"0.584661",
"0.58006394",
"0.57921314",
"0.54990923",
"0.5478452",
"0.54575986",
"0.5421042",
"0.5362069",
"0.5308911",
"0.5292361",
"0.52874297",
"0.52801734",
"0.5268619",
"0.5235136",
"0.52334464",
"0.51688975",
"0.5119408",
"0.50871813",
"0.5081... | 0.78910553 | 0 |
returns the subtask dict for the provided schedule id or name | def get_schedule(self, schedule_id=None, schedule_name=None):
if not schedule_name and not schedule_id:
raise SDKException(
'Schedules',
'102',
'Either Schedule Name or Schedule Id is needed')
if schedule_name and not isinstance(schedule_name,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schedule(self, name):\n return self.__schedules.get(name, None)",
"def get_schedule(schedule_name):\n schedule = calendar.get_schedule(schedule_name)\n if schedule:\n return json.dumps(schedule)\n else:\n return 'Scheudle not found.', 404",
"def schedul... | [
"0.64343715",
"0.63024783",
"0.62107915",
"0.6174132",
"0.61556315",
"0.610999",
"0.6093129",
"0.6050031",
"0.59871644",
"0.59803355",
"0.59572864",
"0.5901275",
"0.5889539",
"0.58879656",
"0.5876428",
"0.5865447",
"0.58631945",
"0.58492035",
"0.5833373",
"0.58270043",
"0.579... | 0.76449376 | 0 |
Adds a new schedule to the schedule policy | def add_schedule(self, schedule_dict):
sub_task = SchedulePolicies.schedule_json(self.policy_type, schedule_dict)
sub_task["subTaskOperation"] = 2
self._subtasks.append(sub_task)
self._modify_schedule_policy_properties() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, schedule):\n try:\n if schedule in self.set:\n self.log.error(\"%s has already been added to this Scheduler.\" %\n schedule)\n return\n self.log.debug('Adding %s to timer for %s.' %\n (schedule, schedule.next... | [
"0.74250984",
"0.71355927",
"0.69699466",
"0.67863303",
"0.67125016",
"0.6662057",
"0.66382873",
"0.6632896",
"0.6592286",
"0.6552454",
"0.65433013",
"0.64711565",
"0.64711565",
"0.64095837",
"0.6307938",
"0.62877345",
"0.61816216",
"0.6143612",
"0.6130588",
"0.6095395",
"0.6... | 0.75510114 | 0 |
Modifies the schedule with the given schedule json inputs for the given schedule id or name | def modify_schedule(self, schedule_json, schedule_id=None, schedule_name=None):
sub_task = self.get_schedule(schedule_id, schedule_name)
if not sub_task:
raise SDKException('Schedules', '105')
if 'pattern' in schedule_json:
self._update_pattern(sub_task["subTask"]["subTas... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_schedule(schedule_name):\n data = flask.request.data\n\n try:\n new_schedule = json.loads(data)\n except json.decoder.JSONDecodeError as e:\n return 'Could not parse request', 400\n\n if not 'commands' in new_schedule:\n return 'Expecting sche... | [
"0.7743731",
"0.67279047",
"0.6662987",
"0.6513656",
"0.6312186",
"0.6296953",
"0.62463963",
"0.6214271",
"0.61839634",
"0.61487067",
"0.61225015",
"0.59058714",
"0.5865127",
"0.5836988",
"0.5809023",
"0.578631",
"0.57738274",
"0.57413137",
"0.57276875",
"0.5719693",
"0.56419... | 0.72743505 | 1 |
Update the appgroups for the provided schedule policy | def update_app_groups(self, app_groups, operation_type):
for app_group in app_groups:
app_group["flags"] = {
operation_type: True
}
self._app_groups = app_groups
self._modify_schedule_policy_properties() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _modify_schedule_policy_properties(self):\n request_json = {\n 'taskInfo':\n {\n 'taskOperation': 1,\n 'associations': self._associations,\n 'task': self._task_json,\n \"appGroup\":\n ... | [
"0.60514146",
"0.6017491",
"0.5801032",
"0.5774563",
"0.5660145",
"0.5314557",
"0.5308427",
"0.5291317",
"0.5261442",
"0.51891553",
"0.5170494",
"0.5151824",
"0.5151469",
"0.5119895",
"0.5093423",
"0.50350976",
"0.50235295",
"0.5010642",
"0.49942756",
"0.49920872",
"0.4981087... | 0.672483 | 0 |
Modifies the task properties of the schedule policy | def _modify_schedule_policy_properties(self):
request_json = {
'taskInfo':
{
'taskOperation': 1,
'associations': self._associations,
'task': self._task_json,
"appGroup":
{
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_schedule_policy_properties(self):\n flag, response = self._commcell_object._cvpysdk_object.make_request(\n 'GET', self._SCHEDULE_POLICY)\n\n if flag:\n if response.json() and 'taskInfo' in response.json():\n _task_info = response.json()['taskInfo']\n\n ... | [
"0.654516",
"0.6501518",
"0.64576036",
"0.62454826",
"0.5983823",
"0.59168255",
"0.5910679",
"0.5860883",
"0.5849798",
"0.584682",
"0.5823728",
"0.578865",
"0.5767186",
"0.57556576",
"0.57262325",
"0.569332",
"0.56703186",
"0.5669823",
"0.5658882",
"0.5653414",
"0.56377894",
... | 0.78114706 | 0 |
Enable a schedule policy. | def enable(self):
enable_request = self._commcell_object._services['ENABLE_SCHEDULE']
request_text = "taskId={0}".format(self.schedule_policy_id)
flag, response = self._commcell_object._cvpysdk_object.make_request(
'POST', enable_request, request_text)
if flag:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule(self, schedule):\n \n self._schedule = schedule",
"def schedule(self, schedule):\n\n self._schedule = schedule",
"def schedule(self, schedule):\n\n self._schedule = schedule",
"def disable(self):\n disable_request = self._commcell_object._services['DISABLE_SCHE... | [
"0.6076319",
"0.598602",
"0.598602",
"0.5872787",
"0.58569723",
"0.58013374",
"0.57859635",
"0.577846",
"0.5678042",
"0.5659059",
"0.565884",
"0.5615133",
"0.5583747",
"0.5581272",
"0.5554138",
"0.5554138",
"0.5554138",
"0.5554138",
"0.5554138",
"0.5554138",
"0.5554138",
"0... | 0.8152682 | 0 |
Disable a Schedule Policy. | def disable(self):
disable_request = self._commcell_object._services['DISABLE_SCHEDULE']
request_text = "taskId={0}".format(self.schedule_policy_id)
flag, response = self._commcell_object._cvpysdk_object.make_request(
'POST', disable_request, request_text)
if flag:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable(self, name: str):\n self._get_backend().disable_alarm(name)",
"def disablePeriodTimer(self):\n taskMgr.remove(\"redoPeriodTimer\")\n self.ignore(\"periodTimerExpired\")",
"def _disable(self):\n self.enabled = False",
"def DisableJob(self, job_urn, token=None):\n cro... | [
"0.66780597",
"0.65176827",
"0.6477232",
"0.64708173",
"0.64140064",
"0.6374233",
"0.63610363",
"0.62808484",
"0.627718",
"0.62570137",
"0.6242061",
"0.62342274",
"0.61584383",
"0.6112165",
"0.61069655",
"0.6104653",
"0.60787183",
"0.6063107",
"0.6016562",
"0.60155",
"0.59988... | 0.84839267 | 0 |
Refresh the properties of the Schedule Policy. | def refresh(self):
self._get_schedule_policy_properties() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _modify_schedule_policy_properties(self):\n request_json = {\n 'taskInfo':\n {\n 'taskOperation': 1,\n 'associations': self._associations,\n 'task': self._task_json,\n \"appGroup\":\n ... | [
"0.7555929",
"0.7277829",
"0.6900463",
"0.6421145",
"0.5809127",
"0.57256013",
"0.5717671",
"0.55591613",
"0.55488825",
"0.55202526",
"0.54688925",
"0.54608816",
"0.5409929",
"0.54048556",
"0.5367008",
"0.52691615",
"0.52305377",
"0.52193534",
"0.5202568",
"0.5201428",
"0.520... | 0.9050719 | 0 |
Test particles analysis functions. | def test_particles(snaptype):
filename = DIR / snaptype.filename
snap = plonk.load_snap(filename)
snap.set_molecular_weight(2.381)
_test_particles(snap=snap, ignore=False)
_test_particles(snap=snap, ignore=True)
snap.close_file() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_visualize():\n # Instantiate three particles for testing\n particles = [Particle(0.3, 0.5, 1), \n Particle(0.0, -0.5, -1), \n Particle(-0.1, -0.4, 3)]\n simulator = ParticleSimulator(particles)\n visualize(simulator)",
"def run_test(dim=3):\n\n traces = []\... | [
"0.65916646",
"0.65091205",
"0.5972552",
"0.5966821",
"0.594892",
"0.59428847",
"0.59341043",
"0.58558434",
"0.58395886",
"0.5815185",
"0.5777197",
"0.5755956",
"0.5753764",
"0.57468134",
"0.5746173",
"0.57402337",
"0.5724067",
"0.57074696",
"0.57026184",
"0.5696788",
"0.5675... | 0.7207122 | 0 |
Test discs analysis functions. | def test_discs(snaptype):
filename = DIR / snaptype.filename
snap = plonk.load_snap(filename)
if snap.num_sinks > 0:
snap.set_central_body(0)
discs.unit_normal(snap=snap)
discs.rotate_edge_on(snap=snap)
discs.rotate_face_on(snap=snap)
discs.position_angle(snap=snap)
discs.incl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ccds(self):\n #TODO write ccds tests",
"def tests():",
"def test_arc_smear(self):",
"def _test():\n import doctest\n doctest.testmod(verbose=1)",
"def _test():\n if sys.argv[1:]:\n if sys.argv[2:]:\n sys.stderr.write(\"usage: python dis.py [-|file]\\n\")\n ... | [
"0.6469077",
"0.6229028",
"0.6192819",
"0.6019091",
"0.5948483",
"0.5922385",
"0.59174657",
"0.59174657",
"0.590769",
"0.5880491",
"0.586606",
"0.5830826",
"0.5827447",
"0.5827447",
"0.5792132",
"0.5787561",
"0.57849216",
"0.5783232",
"0.57571995",
"0.5736418",
"0.5719094",
... | 0.64672244 | 1 |
Helper usable with `ENMLToHTML` `media_filter` parameter to filterout resources that are not images so that output HTML won't contain such invalid element | def images_media_filter(hash_str, mime_type):
return mime_type in MIME_TO_EXTESION_MAPPING | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filterImages(files, cfg):\r\n regex = \"\\.(\" + \"|\".join(cfg.image_formats) + \")$\"\r\n #filter(lambda s: re.match(regex, s), files)\r\n return [s for s in files if re.findall(regex, s)]",
"def test_img(self):\r\n self.assertHtmlEqual(OpenEndedChild.sanitize_html(self.img_dirty), self.img... | [
"0.59438443",
"0.59109825",
"0.5782609",
"0.5777281",
"0.57093173",
"0.5633579",
"0.56107575",
"0.5532139",
"0.5523627",
"0.54416215",
"0.5429895",
"0.5412717",
"0.53685254",
"0.5306241",
"0.5299271",
"0.5268593",
"0.520532",
"0.5193865",
"0.5081212",
"0.5073596",
"0.5060038"... | 0.61483914 | 0 |
given a user and a game, get previous game for user | def get_previous_game(session, user, game):
previous_game = session.query(Game).filter(
Game.deleted_at.is_(None),
sqla.or_(
Game.winner_id == user.id,
Game.loser_id == user.id
),
Game.id < game.id
).order_by(Game.id.desc()).first()
return previous_ga... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_previous_game(team_id: int) -> dict:\n\n logging.info(\"Checking the schedule API endpoint for the previous game.\")\n url = f\"teams/{team_id}?expand=team.schedule.previous\"\n\n response = api.nhl_api(url)\n if not response:\n return None\n\n prev_game_json = response.json()\n pr... | [
"0.67413014",
"0.6734945",
"0.62586236",
"0.6019248",
"0.59625417",
"0.5948261",
"0.5915076",
"0.5891258",
"0.5817394",
"0.57961315",
"0.5793165",
"0.57883805",
"0.5723575",
"0.5714595",
"0.5700319",
"0.56505597",
"0.5644498",
"0.5642966",
"0.5635226",
"0.56259304",
"0.561392... | 0.83225495 | 0 |
Parse serialized example and return feature_dict and label. | def _parse(serialized_example):
feature_map = {
'dayofweek': tf.io.FixedLenFeature([], tf.int64),
'dropofflat': tf.io.FixedLenFeature([], tf.float32),
'dropofflon': tf.io.FixedLenFeature([], tf.float32),
'fare_amount': tf.io.FixedLenFeature([], tf.float32),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parser(serialized_example):\n features = tf.parse_single_example(\n serialized_example,\n features={\n \"image\": tf.FixedLenFeature([], tf.string),\n \"label\": tf.FixedLenFeature([], tf.int64),\n })\n image = tf.decode_raw(features[... | [
"0.7606413",
"0.75634253",
"0.74399966",
"0.74018574",
"0.72884476",
"0.71941066",
"0.71269596",
"0.70110637",
"0.69759965",
"0.69593763",
"0.69391114",
"0.68784344",
"0.68403",
"0.68073916",
"0.6725126",
"0.66745645",
"0.66383845",
"0.6630895",
"0.6602592",
"0.65910774",
"0.... | 0.82604605 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.