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 |
|---|---|---|---|---|---|---|
If there are sequence numbers in the IPv6 ACL, remove them | def _rm_ipv6_acl_sequence_numbers(self):
for acl in self.get_children('startswith', 'ipv6 access-list '):
for entry in acl.children:
if entry.text.startswith('sequence'):
entry.text = ' '.join(entry.text.split()[2:])
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_acl(self, **kwargs):\n # Validate required and accepted parameters\n params_validator.validate_params_slx_ver17s_apply_acl(**kwargs)\n\n # Parse params\n acl_name = self.ip.parse_acl_name(**kwargs)\n callback = kwargs.pop('callback', self._callback)\n acl = self... | [
"0.5408441",
"0.5385359",
"0.52064013",
"0.5154123",
"0.51238096",
"0.5115195",
"0.5109617",
"0.5068291",
"0.5053385",
"0.5036614",
"0.49867594",
"0.4969584",
"0.49682197",
"0.4940877",
"0.49407664",
"0.49260843",
"0.49187565",
"0.48895997",
"0.48849586",
"0.4824361",
"0.4817... | 0.8416185 | 0 |
Add a copy of the ancestry of parent_to_add to self and return the deepest child which is equivalent to parent_to_add | def add_ancestor_copy_of(self, parent_to_add):
base = self
for parent in parent_to_add.lineage():
if parent.root is not parent:
base = base.add_shallow_copy_of(parent)
return base | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_parent(self, parent, *args, **kwargs):\n return parent.add_child(self, **kwargs)",
"def AddParent(self, parent=None):\n if isinstance(parent, Tree):\n parent.AddNode(self)",
"def add_parent(self, node):\n # Ensure that node is a BaseNode\n if not isinstance(node, BaseNode):... | [
"0.7143506",
"0.6888295",
"0.6326358",
"0.61969703",
"0.59369355",
"0.5930564",
"0.5896978",
"0.5784762",
"0.5730257",
"0.56396216",
"0.5617881",
"0.5575947",
"0.5527584",
"0.5464083",
"0.5445128",
"0.5442927",
"0.543735",
"0.54366136",
"0.540554",
"0.5379422",
"0.5377961",
... | 0.7688856 | 0 |
Sets self.order integer on all children | def set_order_weight(self):
for child in self.all_children():
for rule in self.options['ordering']:
if child.lineage_test(rule):
child.order_weight = rule['order'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_ordering(self):\n self._descendants = sorted(self.unordered_descendants(), key=lambda node: node.ord)\n for (new_ord, node) in enumerate(self._descendants, 1):\n node.ord = new_ord",
"def reorder_children(self, increasing=True):\n self.traverse_order_children(self.root... | [
"0.7573093",
"0.69861233",
"0.6946041",
"0.6946041",
"0.6795527",
"0.67951113",
"0.6672119",
"0.6672119",
"0.6672119",
"0.65924275",
"0.6464976",
"0.6464976",
"0.6452091",
"0.641608",
"0.63908696",
"0.638663",
"0.6239694",
"0.62139374",
"0.61743754",
"0.6174167",
"0.61634743"... | 0.7651721 | 0 |
Adds the sectional exiting text as a child | def add_sectional_exiting(self):
# TODO why do we need to delete the delete the sub_child and then
# recreate it?
for child in self.all_children():
for rule in self.options['sectional_exiting']:
if child.lineage_test(rule):
if rule['exit_text'] in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def section(self, label):\n return self.text(label, bold=True)",
"def soft_break(self, el, text):\n\n if el.name == 'p' and el.namespace and el.namespace == self.namespaces[\"text\"]:\n text.append('\\n')",
"def make_bottom_text( self ):\n return None",
"def add_section(self, ... | [
"0.60722476",
"0.5907909",
"0.589407",
"0.58685046",
"0.5809762",
"0.5808015",
"0.572188",
"0.5656439",
"0.56449705",
"0.56381184",
"0.56246924",
"0.56188685",
"0.5572785",
"0.55693084",
"0.5529585",
"0.55236554",
"0.55192935",
"0.551879",
"0.5510168",
"0.54871815",
"0.546705... | 0.67059284 | 0 |
unpack the provided binary data stream into this class's fields | def unpack(self, stream):
if not isinstance(stream, StatefulByteStream):
stream = StatefulByteStream(stream)
# map unpacked values to the fields that they correspond to
for field in self.__fields:
fmt = self.BYTE_ORDER + field.format
slice_size = field.size *... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _unpack(self, headerBytes):\n pass",
"def deserialize(self, data):",
"def parse_from_bytes(self, raw_buffer):\n\n try:\n (cpu_svn,\n self.misc_select,\n _,\n attributes,\n mr_enclave,\n _,\n mr_signer,\n ... | [
"0.6962862",
"0.67571527",
"0.6735019",
"0.66133356",
"0.6599829",
"0.6524207",
"0.6514203",
"0.6513174",
"0.6495409",
"0.64911854",
"0.64876413",
"0.6414714",
"0.6409808",
"0.63841546",
"0.6362015",
"0.63400155",
"0.6332114",
"0.6315264",
"0.63131934",
"0.6259287",
"0.625596... | 0.686265 | 1 |
append_check_sum is used for exporting Team Manager/Meet Manager compliant files. | def append_check_sum(input_str, file_format=None):
# check if inputStr is a string
if not isinstance(input_str, unicode):
raise CheckSumExportException("input_str parameter is not a string")
#check if fileFormat is specified and if it is, if it is a string
if file_format is None:
if len... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_sum(self) -> str:\n pass",
"def checksum(self, check: bool):\r\n self._checksum = check\r\n self.checksum_hist.append(check)",
"def add_check_sums(hdu_list: fits.HDUList):\n for hdu in hdu_list:\n hdu.verify(\"fix\")\n hdu.add_checksum()\n hdu.header.inser... | [
"0.57053113",
"0.56518656",
"0.5623373",
"0.5575254",
"0.55170244",
"0.5495961",
"0.52891517",
"0.5253438",
"0.5153764",
"0.512485",
"0.50724775",
"0.5054209",
"0.50178397",
"0.50017375",
"0.49846122",
"0.49659887",
"0.4963159",
"0.49346223",
"0.49120694",
"0.49071398",
"0.48... | 0.64782333 | 0 |
Adds enableAutopublishing field to ATCT types | def makeATCTTypesAutoPublishAware():
makeTypesAutoPublishAware(atct_types)
print "---------- PATCH: ADDED enableAutopublishing field TO ATCT TYPES ----------" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _enableautopublishing(obj, **kwargs):\n\n from collective.autopublishing.behavior import IAutoPublishing\n\n if IAutoPublishing.providedBy(obj):\n return getattr(obj, \"enableAutopublishing\", True)\n\n return False",
"def makeTypesAutoPublishAware(types):\n for t in types:\n t.sche... | [
"0.6962681",
"0.6759251",
"0.5387826",
"0.50007504",
"0.49590155",
"0.49114823",
"0.49056712",
"0.48902673",
"0.48902673",
"0.48852003",
"0.48625377",
"0.48427656",
"0.48221064",
"0.4786588",
"0.47820434",
"0.47744322",
"0.47438973",
"0.47431564",
"0.4741863",
"0.4723688",
"0... | 0.85065866 | 0 |
Requests the module description and available output channels. Input ADDR is the module location (integer 1 through 6). | def get_module_info(self, c, ADDR):
if self.device_detected == True:
resp = yield subprocess.check_output("cacli DESC "+str(ADDR))
else:
resp = "Device not connected."
print "Device not connected. "
#Eventually make this actually throw an error inste... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_info(node):\n\n if \"cpu\" in node and \"total_mbufs\" in node[\"cpu\"]:\n total_mbufs = node[\"cpu\"][\"total_mbufs\"]\n if total_mbufs != 0:\n print(\"Total Number of Buffers: {}\".format(total_mbufs))\n\n vpp = VppPCIUtil(node)\n vpp.get_all_d... | [
"0.5255414",
"0.5238491",
"0.5188195",
"0.5180859",
"0.5165055",
"0.51609516",
"0.5111383",
"0.5096917",
"0.5089235",
"0.5071356",
"0.5061544",
"0.5058985",
"0.5021037",
"0.501727",
"0.5011895",
"0.49662185",
"0.49413484",
"0.49329716",
"0.489246",
"0.48664945",
"0.4837501",
... | 0.624494 | 0 |
Requests information about a user defined Tags (name) or set actuator Types. Input ADDR is the module location (integer 1 through 6). Input CH is the module channel, integer 1 through 3. Returns array of strings. First element is the Type. Second element is the Tag. | def get_actuator_info(self, c, ADDR, CH):
if self.device_detected == True:
resp = yield subprocess.check_output("cacli INFO "+str(ADDR) + " " + str(CH))
type = self.find_between(resp,"TYPE :","\r\n")
tag = self.find_between(resp,"TAG :","\r\n")
info = [type,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_tags(reader_ip, event_type):\n # Open socket using reader IP address\n cmd = rapid.Command(reader_ip)\n cmd.open()\n print \"Connection to %s opened\" % (reader_ip)\n\n # Reader Login\n cmd.execute(\"reader.login\", (\"admin\", \"readeradmin\"))\n rc = cmd.execute(\"reader.who_am_i\",... | [
"0.55414027",
"0.5046226",
"0.50079",
"0.49143046",
"0.49027643",
"0.48714507",
"0.48003745",
"0.46709114",
"0.4625631",
"0.46155882",
"0.4607507",
"0.46046448",
"0.45815864",
"0.45771107",
"0.45771107",
"0.45745647",
"0.45738086",
"0.4564302",
"0.45355794",
"0.45329583",
"0.... | 0.5941915 | 0 |
Moves specified actuator with specified parameters. ADDR and CH specify the module address (1 through 6) and channel (1 through 3). TYPE specifies the cryo actuator model. TEMP is the nearest integer temperature (0 through 300). DIR determines CW (1) vs CWW (0) stack rotation. FREQ is the interger frequency of operatio... | def move(self, c, ADDR, CH, TYPE, TEMP, DIR, FREQ, REL, STEPS, TORQUE = None):
if self.device_detected == True:
#Add input checks
if TORQUE == None:
resp = yield subprocess.check_output("cacli MOV "+str(ADDR) + " " + str(CH)
+ " " + TYPE + " " + str(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_xyz(self,c, ADDR, TEMP, FREQ, REL, XYZ, TORQUE = None):\r\n try:\r\n VEC = np.dot(self.T1,XYZ)\r\n VEC = self.adjustForWeight(VEC)\r\n VEC = [round(x) for x in VEC]\r\n print VEC\r\n \r\n #have each cycle take ~1 second\r\n ... | [
"0.57304",
"0.56972367",
"0.5554035",
"0.54021627",
"0.51400924",
"0.49471164",
"0.4805451",
"0.47309983",
"0.47292915",
"0.46970686",
"0.45975408",
"0.45794663",
"0.45610094",
"0.4551254",
"0.4550327",
"0.45158133",
"0.45089412",
"0.45004815",
"0.44989535",
"0.44668517",
"0.... | 0.67335975 | 0 |
Centers the piezos specified by ADDR in order to keep track of position. This will run the piezos through their full movement range. Make sure this is only called with no sensitive sample and be destroyed. | def center(self,c, ADDR):
#FIGURE OUT HOW TO DO THIS
#Actually pretty sure this is impossible to do from software
returnValue('Success!') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_on_spawn(self):\n self.center_on(*self.world.metadata['playerStart'])",
"def do_polar_alignment_test(self, *arg):\n if self.ready is False:\n return\n\n start_time = current_time(flatten=True)\n\n base_dir = '{}/images/drift_align/{}'.format(\n os.gete... | [
"0.5961",
"0.57463413",
"0.56795865",
"0.5533931",
"0.54940224",
"0.5443845",
"0.5440208",
"0.543193",
"0.541925",
"0.53592706",
"0.53592706",
"0.53461343",
"0.53208303",
"0.5320681",
"0.5311021",
"0.5308331",
"0.52896976",
"0.52896976",
"0.52896976",
"0.52491367",
"0.5239588... | 0.62783 | 0 |
Request CADM move sample in the according to the arbitrary vector XYZ. XYZ should be a 3 element list with the number of steps to be taken in the x, y, and z direction respectively. Intergers not necessary because the xyz coordinates need to be transformed into other coordinates first, after which they will be rounded.... | def move_xyz(self,c, ADDR, TEMP, FREQ, REL, XYZ, TORQUE = None):
try:
VEC = np.dot(self.T1,XYZ)
VEC = self.adjustForWeight(VEC)
VEC = [round(x) for x in VEC]
print VEC
#have each cycle take ~1 second
cycle_size = int(FR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_z(self,c, ADDR, TEMP, FREQ, REL, Z, TORQUE = None):\r\n \r\n #Calculate steps in knobs 1 2 and 3\r\n VEC = np.dot(self.T1,[0.0,0.0,Z])\r\n VEC = self.adjustForWeight(VEC)\r\n VEC = [round(x) for x in VEC]\r\n print VEC\r\n \r\n #Have each cycle take ... | [
"0.54861337",
"0.53565013",
"0.53368104",
"0.52942014",
"0.5061911",
"0.5029198",
"0.49740016",
"0.49231988",
"0.49029607",
"0.48911953",
"0.48539475",
"0.4834735",
"0.47666973",
"0.47465584",
"0.47099647",
"0.46815482",
"0.46700305",
"0.46635395",
"0.46635395",
"0.46608484",
... | 0.6438862 | 0 |
Request CADM move sample in the according to the arbitrary vector XYZ. XYZ should be a 3 element list with the number of steps to be taken in the x, y, and z direction respectively. Intergers not necessary because the xyz coordinates need to be transformed into other coordinates first, after which they will be rounded.... | def move_z(self,c, ADDR, TEMP, FREQ, REL, Z, TORQUE = None):
#Calculate steps in knobs 1 2 and 3
VEC = np.dot(self.T1,[0.0,0.0,Z])
VEC = self.adjustForWeight(VEC)
VEC = [round(x) for x in VEC]
print VEC
#Have each cycle take ~1.5 seconds
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_xyz(self,c, ADDR, TEMP, FREQ, REL, XYZ, TORQUE = None):\r\n try:\r\n VEC = np.dot(self.T1,XYZ)\r\n VEC = self.adjustForWeight(VEC)\r\n VEC = [round(x) for x in VEC]\r\n print VEC\r\n \r\n #have each cycle take ~1 second\r\n ... | [
"0.6440305",
"0.5357005",
"0.53352326",
"0.52927643",
"0.50602823",
"0.50276756",
"0.4972673",
"0.49217618",
"0.49024922",
"0.48894984",
"0.48508203",
"0.48323593",
"0.476565",
"0.47450444",
"0.4708342",
"0.4680033",
"0.4670589",
"0.46641427",
"0.46641427",
"0.4659771",
"0.46... | 0.54873776 | 1 |
Verbalise punctuation in 'textFilePath'. | def verbalisePunctuation(self):
for i, strText in enumerate(self.sentencesList):
#For all punctuation marks
for regex, value in list(TextRepresentation.PUNCTUATION.items()):
strText = re.sub(regex, value, strText)
self.sentencesList[i] = strText | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeOwnPunctuation(self):\n\t\tself.textFile = self.removePunctuation(self.open(self.filePath)).split()",
"def clean_text(txt):\n\n for symbol in \"\"\".,'?!()/-:;\"\"\":\n txt = txt.replace(symbol, '')\n txt = txt.lower()\n txt = txt.split()\n return txt",
"def cleanupText(path):\n ... | [
"0.7281496",
"0.65980756",
"0.6584256",
"0.654501",
"0.6430311",
"0.63022417",
"0.62523586",
"0.6225026",
"0.6210525",
"0.6191587",
"0.6176901",
"0.6176755",
"0.6172276",
"0.61582357",
"0.61551625",
"0.6148912",
"0.61315274",
"0.60980105",
"0.60980105",
"0.60933495",
"0.60932... | 0.71744287 | 1 |
Return the type of the underlying document. Raise an exception when unknown. | def _getDocumentType(self):
fileName, fileExtension = os.path.splitext(self.sourceFileName)
documentType = None
for knownType in list(TextRepresentation.KNOWNTYPES.keys()):
if knownType == fileExtension[1:]:
documentType = knownType
if documentType is None:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_doc_type(self):\n if not self.is_documented():\n return DocType.none\n if self._rawdoc.is_local():\n return DocType.internal\n return self._rawdoc.get_visibility()",
"def document_type(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"docu... | [
"0.76666296",
"0.7492897",
"0.7062189",
"0.67980164",
"0.66945153",
"0.66379994",
"0.6350302",
"0.6309663",
"0.6273911",
"0.6244093",
"0.6189533",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",
"0.6183449",... | 0.7964641 | 0 |
Returns the globstrings for getting M1 and M2 files out of the subdirectory, doesnt contain the descend into the subdir anymore. `subdirglob` is a globstring into a subdir relative to the basedir. | def get_glob_strings(subdirglob):
dirname = path.dirname(subdirglob)
basename = path.basename(subdirglob)
assert ((("_M1_" in subdirglob) or ("_M2_" in subdirglob)) or ("_S_" in subdirglob)), \
("_M1_ or _M2_ not in subdirglob, cant differentiate between M1 and M2, aborting."
f"glob: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def glob(glob_pattern: str, directoryname: str) -> List[str]:\n matches = []\n for root, dirnames, filenames in os.walk(directoryname):\n for filename in fnmatch.filter(filenames, glob_pattern):\n absolute_filepath = os.path.join(root, filename)\n matches.append(absolute_filepath... | [
"0.5916455",
"0.5887615",
"0.58773214",
"0.58773214",
"0.57660085",
"0.57416576",
"0.5612709",
"0.5590412",
"0.5584732",
"0.55376524",
"0.5522868",
"0.5417981",
"0.54049164",
"0.53778815",
"0.53727657",
"0.53702134",
"0.5357846",
"0.53505063",
"0.5350162",
"0.5341075",
"0.524... | 0.7825845 | 0 |
Splits the filenames into those from Telescope M1 and M2 | def split_filenames(filenames):
fm1 = [fname for fname in filenames if "_M1_" in fname]
fm2 = [fname for fname in filenames if "_M2_" in fname]
return fm1, fm2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_telescopes(fnames):\n if isinstance(fnames, str):\n fnames = glob_and_check(fnames)\n fnames1 = [fname for fname in fnames if \"_M1_\" in fname]\n fnames2 = [fname for fname in fnames if \"_M2_\" in fname]\n return fnames1, fnames2",
"def splitFilename(filename):\n\n if filen... | [
"0.6869177",
"0.6430804",
"0.6268593",
"0.6030786",
"0.60156405",
"0.6013226",
"0.59532857",
"0.5944488",
"0.5916908",
"0.5900731",
"0.5892232",
"0.58632034",
"0.5850609",
"0.57814455",
"0.5769506",
"0.57669324",
"0.5765677",
"0.57340425",
"0.5681897",
"0.56788385",
"0.567787... | 0.76343876 | 0 |
Returns the complete directory of the globstr when given basedir and the globstr relative to basedir. | def get_dir_from_glob(basedir, globstr):
directory = path.abspath(basedir) + path.dirname(globstr)
directory = path.join(directory, "")
return directory | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getBaseFolder(globalsDict=None):\n globalsDictHere = globalsDict or globals()\n baseFolder = \"\"\n if globalsDictHere['__name__'] == \"__main__\":\n baseFolder = os.path.split(sys.argv[0])[0]\n # print(('baseFolder from argv: %s'% baseFolder))\n elif globalsDictHere['__file__']:\n ... | [
"0.629505",
"0.6257941",
"0.6153911",
"0.61254823",
"0.6059204",
"0.5946701",
"0.5944693",
"0.59154135",
"0.585148",
"0.58466715",
"0.5784248",
"0.5737764",
"0.57186085",
"0.5708487",
"0.5701268",
"0.5697349",
"0.5693046",
"0.5662574",
"0.5574513",
"0.54947746",
"0.5486882",
... | 0.86459345 | 0 |
extracts the mergecols from the _S_ root (superstarglob) files and merges the energies | def merge_wrapper(processdir, basedir, starglob, superstarglob, calibrootglob, njobs=2, invert=False):
for glob in [starglob, superstarglob, calibrootglob]:
assert path.dirname(glob), \
f"Glob : {glob} should be/contain a subdirectory"
superstarGlobNew = get_glob_strings(superstarglob)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def datamerge_run(filenames, outdir, roc_cols):\n \n tbldict = collect2dict(filenames, outdir)\n tbldict = cogtest_manipulation(tbldict, roc_cols)\n \n #count number of tps\n tbldict['cogtests'] = count_instances(tbldict['cogtests'], 'codeb', 'NP_NoTps')\n tbldict['aseg_change'] = count_instan... | [
"0.5888243",
"0.56524366",
"0.5617107",
"0.5513934",
"0.54756737",
"0.5444855",
"0.5439256",
"0.5407577",
"0.5280827",
"0.52725893",
"0.5247397",
"0.52251565",
"0.5191612",
"0.5171436",
"0.51419157",
"0.5122677",
"0.50893784",
"0.50718045",
"0.50425047",
"0.50397617",
"0.5014... | 0.6208765 | 0 |
Simple generator of primes by trial division | def primes():
yield 2
candidate = 3
while True:
for i in range(3, int(sqrt(candidate)) + 1, 2):
if (candidate % i) == 0:
break
else:
yield candidate
candidate += 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_primes():\n\n n = 1\n while True:\n while not isPrime(n):\n n += 1\n\n yield n\n n += 1",
"def gen_primes():\n\tyield 2\n\tyield 3\n\tprime_list = [2, 3]\n\twhile 1:\n\t\tnext = prime_list[-1] + 2\n\t\ti = 0\n\t\twhile i < len(prime_list):\n\t\t\tif next%prime_list[i... | [
"0.80137175",
"0.77621424",
"0.7665605",
"0.7564029",
"0.7559787",
"0.7539917",
"0.73725927",
"0.727737",
"0.71787924",
"0.714312",
"0.713863",
"0.71249187",
"0.7116757",
"0.7101361",
"0.70969033",
"0.7089131",
"0.7069633",
"0.7069145",
"0.70630926",
"0.70569324",
"0.704758",... | 0.7840028 | 1 |
Return the unique prime factorization of `number` assuming number <= 1 million cf the Fundamental Theorem of Arithmetic | def prime_factorization(number):
global primes_under_1M
assert number <= 1_000_000
factors = []
running_product = 1
current_number = number
# Loop through the primes, iteratively dividing our
# number by each prime `p` so long as `p` exactly
# divides `current_number`
for p in pri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_unique_factors(num):\n a = num\n m = int(num ** 0.5) if num > 100 else num\n factors = []\n primes = sieve(m)\n # Divide the number by compatible primes until it is 1\n # (or we run out of primes...)\n for p in primes:\n if a % p == 0:\n a = a / p\n factors... | [
"0.7623067",
"0.72447276",
"0.72008526",
"0.71466506",
"0.71395624",
"0.71260005",
"0.7038484",
"0.7021164",
"0.6997865",
"0.69853556",
"0.69795007",
"0.69734",
"0.6948307",
"0.69408995",
"0.69343865",
"0.6893117",
"0.6893014",
"0.68922955",
"0.6884946",
"0.6881858",
"0.68732... | 0.8159412 | 0 |
If the suffix of a child_id is numeric, the whole hierarchy is searchable to the leaf nodes. If the suffix of a child_id is alphabetic, the whole hierarchy is not searchable. | def _is_hierachy_searchable(child_id: str) -> bool:
pieces_of_child_id_list = child_id.split('.')
suffix = pieces_of_child_id_list[len(pieces_of_child_id_list) - 1]
return suffix.isnumeric() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_subhalo(self, childid, parentid):\n if (childid in self._halos[parentid].properties['children']):\n return True\n else:\n return False",
"def _is_child(self, parent, child): # type: (str, str) -> bool\n return child != parent and child.startswith(parent + \".\")... | [
"0.5488853",
"0.5385023",
"0.5233182",
"0.50972",
"0.50318193",
"0.4960036",
"0.49326897",
"0.49024475",
"0.48999116",
"0.48729253",
"0.4871233",
"0.48577115",
"0.48574862",
"0.48468843",
"0.4816291",
"0.48138228",
"0.47902393",
"0.47179863",
"0.47115165",
"0.469999",
"0.4692... | 0.8063963 | 0 |
Get the action method for an Algorithm. If method_name is None, the primary action method is returned (the one listed first in `Algorithm._action_methods`). Otherwise, the action method belonging to the respective name is returned. | def get_action_method(instance: Algorithm, method_name: Optional[str] = None) -> Callable:
method_names = get_action_methods_names(instance)
if method_name is not None:
if method_name not in method_names:
raise ValueError(
"`method_name` must be one of the specified action me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_method(self, name=None):\n return self.gateway and self.gateway.method or None",
"def _get_action_from_http_method(self, http_method):\n http_method = http_method.lower()\n if http_method == 'get':\n return 'list' if issubclass(self.callback, ListModelMixin) else 'retrieve... | [
"0.6643434",
"0.65293586",
"0.6413036",
"0.62758154",
"0.61746657",
"0.6106306",
"0.6037263",
"0.6004484",
"0.5983328",
"0.59728557",
"0.5909148",
"0.5905452",
"0.5905452",
"0.5890808",
"0.5871449",
"0.5817096",
"0.58095455",
"0.5774518",
"0.57545245",
"0.5741709",
"0.5719946... | 0.8294379 | 0 |
Get the names of all action methods of a class. This basically returns `instance_or_cls._action_method`, but ensures that the return type is a tuple. | def get_action_methods_names(instance_or_cls: Union[Type[Algorithm], Algorithm]) -> Tuple[str, ...]:
method_names = instance_or_cls._action_methods
if isinstance(method_names, str):
method_names = (method_names,)
if not isinstance(method_names, tuple) and len(method_names) == 0:
if isclass(i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions(cls):\n return [m for m in cls.__dict__ if not \"__\" in m]",
"def _methods_of(cls):\n # The idea of unbound methods exists in Python 2 and was removed in\n # Python 3, so \"inspect.ismethod\" is used here for Python 2 and\n # \"inspect.isfunction\" for Python 3.\n all_methods = in... | [
"0.6725654",
"0.67109776",
"0.665491",
"0.64789116",
"0.6402844",
"0.6323588",
"0.6282057",
"0.62751466",
"0.6228913",
"0.61890525",
"0.61869615",
"0.6094848",
"0.6094848",
"0.6094848",
"0.6071644",
"0.6056207",
"0.59731996",
"0.59709716",
"0.5959929",
"0.59402436",
"0.593623... | 0.78314745 | 0 |
Get all "Action Params" / "Other Parameters" of the Algorithm. Action params are all parameters passed as input to the action method. | def get_action_params(instance: Algorithm) -> Dict[str, Any]:
params = instance.get_params()
attrs = {
v: getattr(instance, v)
for v in vars(instance)
if not v.endswith("_") and not v.startswith("_") and v not in params
}
return attrs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_action_params(self, a):\n return self.params[a]",
"def getParams(self):\n\n\t\tparams = {\"Nparticles\":self.__Nparticles,\"Nkicks\":self.__Nkicks,\"kappa\":self.__kappa, \"eta\":self.__eta,\"gamma\":self.__gamma, \"omega\":self.__omega,\n\t\t\"Kbt\":self.__Kbt, \"tk\":self.__tk}\n\n\t\treturn par... | [
"0.70934117",
"0.6718168",
"0.66945964",
"0.6678622",
"0.6638862",
"0.66280246",
"0.6627631",
"0.65940255",
"0.65821403",
"0.65821403",
"0.65637183",
"0.65637183",
"0.65637183",
"0.64723307",
"0.64681345",
"0.64640665",
"0.64528596",
"0.64158535",
"0.6391029",
"0.6391029",
"0... | 0.7409327 | 0 |
Check if the action method was already called/results were generated. | def is_action_applied(instance: Algorithm) -> bool:
if len(get_results(instance)) == 0:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _result_already_returned(self):\n return self.deferred.called",
"def final_check(self):\n for func in self.called.keys():\n self.assertTrue(self.called[func], \"%s was not called\" % (func,))",
"def match_action(self, action):\n\n return hasattr(self, self._action_handler_na... | [
"0.65325475",
"0.6513868",
"0.6394428",
"0.635402",
"0.61890197",
"0.6127541",
"0.6109208",
"0.6106263",
"0.6106263",
"0.60338444",
"0.6010057",
"0.59864855",
"0.59193176",
"0.5911129",
"0.5904034",
"0.58456475",
"0.5825794",
"0.58197397",
"0.57962",
"0.57962",
"0.5773618",
... | 0.6948303 | 0 |
Mark a method as an "action" and apply a set of runtime checks to prevent implementation errors. This decorator marks a method as action. Each algorithm is expected to have at least one action method. For pipelines this action method is called "run". This means, when implementing a custom action or run method, it must ... | def make_action_safe(
action_method: Callable[Concatenate[AlgorithmT, P], AlgorithmT]
) -> Callable[Concatenate[AlgorithmT, P], AlgorithmT]:
if getattr(action_method, ACTION_METHOD_INDICATOR, False) is True:
# It seems like the decorator was already applied and we do not want to apply it multiple times ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_action(*args, **kwargs):\n raise NotImplementedError()",
"def do_action(self, action, **kwargs):\r\n print(action)\r\n action_method = getattr(self, action._method.__name__)\r\n if action_method:\r\n action_method(**kwargs)",
"def take_action(self, action):\n\... | [
"0.64787984",
"0.6455812",
"0.6393445",
"0.6273497",
"0.6248149",
"0.6213524",
"0.61921144",
"0.614397",
"0.61419356",
"0.6076854",
"0.6076854",
"0.60382336",
"0.6000338",
"0.5990066",
"0.596705",
"0.596705",
"0.596705",
"0.596705",
"0.596705",
"0.596705",
"0.5950706",
"0.5... | 0.73302245 | 0 |
Apply a set of runtime checks to a custom `self_optimize` method to prevent implementation errors. | def make_optimize_safe(
self_optimize_method: Callable[Concatenate[OptimizableT, P], OptimizableT]
) -> Callable[Concatenate[OptimizableT, P], OptimizableT]:
if getattr(self_optimize_method, OPTIMIZE_METHOD_INDICATOR, False) is True:
# It seems like the decorator was already applied, and we do not want ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accept_optimize():\n pass",
"def self_optimize(self, dataset: DatasetT, **kwargs) -> Self:\n try:\n # This seems hacky, but is used to avoid infinite recursion\n setattr(type(self), \"__optimize_not_implemented__\", True)\n out = self.self_optimize_with_info(dataset... | [
"0.6009816",
"0.6001013",
"0.59160036",
"0.5702203",
"0.5633489",
"0.54485035",
"0.54099053",
"0.5349612",
"0.52543825",
"0.52409315",
"0.5170419",
"0.5148132",
"0.51057553",
"0.5033916",
"0.49907643",
"0.49848083",
"0.4968956",
"0.49565458",
"0.49478036",
"0.49183828",
"0.49... | 0.7030773 | 0 |
Strip the stderr of a Python process from potential debug output emitted by the interpreter. This will typically be run on the result of the communicate() method of a subprocess.Popen object. | def strip_python_stderr(stderr):
stderr = re.sub(br"\[\d+ refs, \d+ blocks\]\r?\n?", b"", stderr).strip()
return stderr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def debug(line):\n sys.stderr.write(line + \"\\n\")\n sys.stderr.flush()",
"def stderr(self):\n if self._stderr is None:\n stderr = [p.stderr.read() for p in self.processes if p.stderr]\n output = b'\\n'.join(stderr).strip()\n if not isinstance(output, str):\n ... | [
"0.5967011",
"0.589786",
"0.5790933",
"0.5673864",
"0.5622882",
"0.55554366",
"0.5553385",
"0.5504194",
"0.5424705",
"0.53817785",
"0.5293466",
"0.5291438",
"0.52749884",
"0.52310896",
"0.52268976",
"0.52113926",
"0.5170546",
"0.5169454",
"0.51536196",
"0.510776",
"0.507081",... | 0.69125473 | 0 |
Prints 3 plots for linear assumptions analysis This function takes in a list of predicted y_hats and a list of the | def analysis_plot(predictions, ys):
fig, (ax1, ax2, ax3) = plt.subplots(1, 3, figsize=(20, 5))
residuals = ys - predictions
# Plot 1 - Predicted vs Actual
sns.scatterplot(predictions, ys, ax=ax1)
ax1.set_title('Predicted vs Actual', fontsize=20)
ax1.set(xlabel='Predicted Ys', ylabel='Actual Ys... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_observed_predicted(y_data, y_predict, ols_line=False, model_fit=None, figsize=(15, 10), save=False, end_name_fig='', folder='Charts'): \r\n\r\n end_name_fig = end_name_fig + '_' if end_name_fig is not None else ''\r\n\r\n fig, ax = plt.subplots(figsize=figsize)\r\n ax.scatter(y_data, y_predict... | [
"0.65088475",
"0.64450926",
"0.64100355",
"0.63321865",
"0.63073844",
"0.6301566",
"0.6285488",
"0.62601894",
"0.62367177",
"0.6230777",
"0.62141186",
"0.61841685",
"0.6178527",
"0.61648494",
"0.6145391",
"0.6144818",
"0.61439085",
"0.61359733",
"0.6135566",
"0.6133642",
"0.6... | 0.73881763 | 0 |
Prints report of a cross validation. This method takes in a list of the r^2s and the coefficients and prints a neat report of the results of a cross validation. | def print_results(name, train_r2, val_r2, coeffs, poly):
if poly:
print(f"With Polynomial Features: degree = {poly}...\n")
print(f'{name} Regression Scores: ', val_r2, '\n')
print(f'{name}.R. Train - Mean R^2: {np.mean(train_r2):.3f} +- {np.std(train_r2):.3f}')
print(f'{name}.R. Val - Mean R^2:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross_validation_visualization(lambds, score_tr, score_te):\n plt.semilogx(lambds, score_tr, marker=\".\", color='b', label='train score');\n plt.semilogx(lambds, score_te, marker=\".\", color='r', label='test score');\n plt.xlabel(\"lambda\")\n plt.ylabel(\"score\")\n plt.title(\"cross validati... | [
"0.62587345",
"0.6133166",
"0.60486656",
"0.6015816",
"0.59888154",
"0.59455055",
"0.5901886",
"0.5839792",
"0.5825753",
"0.5815804",
"0.58060807",
"0.5728041",
"0.57201964",
"0.568926",
"0.56739503",
"0.56676227",
"0.5591121",
"0.55885464",
"0.5580657",
"0.5567078",
"0.55609... | 0.65536094 | 0 |
Returns predictions made by a given model. This function takes in an X_matrix and uses the imported model to return the predicted (yhat) values as a list. | def get_predicts(x_matrix, model, poly, scale, dummy_idx):
x_matrix = np.array(x_matrix)
# adding polynomial features and/or scaling before prediction
temp_list = split_poly_scale_join([x_matrix], dummy_idx, poly, scale)
x_matrix = temp_list[0]
return model.predict(x_matrix) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(x_tst, model):\n\n predictions = model.predict(x_tst)\n return predictions",
"def predict(model, X_testing):\n predictions = model.predict(X_testing)\n\n return predictions",
"def model_predict(classifier, X_test:list) -> list:\n y_predict = classifier.predict(X_test)\n re... | [
"0.73035485",
"0.71050286",
"0.70261675",
"0.68585396",
"0.68142384",
"0.677259",
"0.6760893",
"0.6750874",
"0.66930443",
"0.6654089",
"0.66475666",
"0.66246563",
"0.661087",
"0.657713",
"0.6550398",
"0.65496695",
"0.6531237",
"0.6531102",
"0.649448",
"0.64675003",
"0.642741"... | 0.7119781 | 1 |
Excludes dummy columns to add polynomial features and/or scale attributes. This function iterates over list of matrices and puts aside their dummy attributes in order to add polynomial features and scale the numerical values. Then, it combines the attributes and returns the resulting matrices. | def split_poly_scale_join(matrices, dummy_idx, poly, scale):
adjusted_matrices = []
for matrix in matrices:
if dummy_idx:
# Split the matrix into numerical and dummies
matrix, matrix_dummies = np.split(matrix, [dummy_idx], axis=1)
# add polynomial features to numerical... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess_features(features):\r\n rowsum = np.array(features.sum(1))\r\n r_inv = np.power(rowsum, -1).flatten()\r\n r_inv[np.isinf(r_inv)] = 0.\r\n r_mat_inv = np.diag(r_inv)\r\n features = r_mat_inv.dot(features)\r\n return features",
"def prepare_features(groups, do_scale):\n feature_... | [
"0.5560244",
"0.55353713",
"0.55022645",
"0.55022645",
"0.54975176",
"0.54975176",
"0.54898787",
"0.5452808",
"0.541256",
"0.5363212",
"0.53405267",
"0.53396016",
"0.53237796",
"0.53237796",
"0.5215232",
"0.50954026",
"0.50924695",
"0.50693184",
"0.5062487",
"0.5029951",
"0.4... | 0.6392005 | 0 |
Tests that add() correctly adds a Task to storage | def test_add(self):
self.my_task.key = self.task_storage.add(self.my_task)
new_task = self.task_storage.find(self.my_task.key)
new_task.key = self.task_storage.add(new_task)
self.assertNotEqual(self.my_task.key, new_task.key)
self.task_storage.delete(new_task.key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, task):\n pass",
"def add(self, task):\n raise NotImplementedError()",
"def test_find(self):\n self.my_task.key = self.task_storage.add(self.my_task)\n new_task = self.task_storage.find(self.my_task.key)\n\n self.assertEqual(self.my_task, new_task)",
"def test_... | [
"0.76441354",
"0.7422072",
"0.7398845",
"0.73473823",
"0.7283399",
"0.726891",
"0.719649",
"0.7159277",
"0.70757115",
"0.7048197",
"0.6881506",
"0.68018115",
"0.6794567",
"0.67916185",
"0.67905664",
"0.6783384",
"0.6783384",
"0.6783384",
"0.6783384",
"0.67813575",
"0.6722948"... | 0.8637676 | 0 |
Tests that find() correctly returns a Task given a key | def test_find(self):
self.my_task.key = self.task_storage.add(self.my_task)
new_task = self.task_storage.find(self.my_task.key)
self.assertEqual(self.my_task, new_task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_task(self, key_task):\n task = None\n scanned_tasks = []\n\n with open(self.path_to_task_file, 'r') as file:\n for line in file:\n current_task = Task()\n current_task.load(line)\n\n if current_task.key == key_task:\n ... | [
"0.69084066",
"0.6853333",
"0.68443716",
"0.64593273",
"0.6452229",
"0.64300704",
"0.6424204",
"0.6378312",
"0.6299489",
"0.6238787",
"0.6218941",
"0.61991155",
"0.6158822",
"0.6088962",
"0.6004947",
"0.59960586",
"0.59647334",
"0.59647334",
"0.5919875",
"0.5909606",
"0.59089... | 0.7447334 | 0 |
Tests that get_all() returns a list of all Tasks | def test_get_all(self):
self.my_task.key = self.task_storage.add(self.my_task)
task_list = self.task_storage.get_all()
self.assertEqual(task_list[0], self.my_task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all():\n return list(tasks.find({}))",
"def get_all_tasks(self):\n \n sql = \"select * from tasks;\"\n return self._query_all(sql)",
"def test_task_list():\n # Fake pyramid request, useful for testing.\n request = testing.DummyRequest()\n\n pytest.fail('Not implemented ... | [
"0.78161174",
"0.72776675",
"0.7262699",
"0.7231321",
"0.7122035",
"0.69549555",
"0.69116324",
"0.6873156",
"0.68698835",
"0.6842177",
"0.67857534",
"0.67637753",
"0.675407",
"0.6740187",
"0.6708301",
"0.6706077",
"0.66224027",
"0.6617143",
"0.66079676",
"0.6603936",
"0.65976... | 0.7713649 | 1 |
Tests that delete() correctly deletes a Task from storage | def test_delete(self):
new_task = task.Task()
self.my_task.key = self.task_storage.add(self.my_task)
key = self.task_storage.delete(self.my_task.key)
new_task = self.task_storage.find(key)
self.assertIsNone(new_task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_no_match(self):\n self.my_task.key = self.task_storage.add(self.my_task)\n\n self.task_storage.delete(self.my_task.key)\n\n self.key = self.task_storage.delete(self.my_task.key)\n\n self.assertIsNone(self.key)",
"def test_delete(self):\n # add a task\n se... | [
"0.8145864",
"0.7770039",
"0.76899",
"0.75120354",
"0.74010766",
"0.7174947",
"0.71608794",
"0.7150028",
"0.7131688",
"0.7089983",
"0.7040682",
"0.7018786",
"0.69417983",
"0.6921762",
"0.68974316",
"0.68915594",
"0.6891311",
"0.68886715",
"0.68705547",
"0.6846934",
"0.6801591... | 0.86244047 | 0 |
Tests delete()'s handling of no matching key | def test_delete_no_match(self):
self.my_task.key = self.task_storage.add(self.my_task)
self.task_storage.delete(self.my_task.key)
self.key = self.task_storage.delete(self.my_task.key)
self.assertIsNone(self.key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_nonexist(self):\n promotion = PromotionFactory()\n promotion.id = '1cak41-nonexist'\n try:\n promotion.delete()\n except KeyError:\n self.assertRaises(KeyError)",
"def testDeletingUnknownKey(self):\n\n memcache.delete('unknown')",
"def te... | [
"0.79012454",
"0.7562065",
"0.75430506",
"0.75408924",
"0.7473593",
"0.7439396",
"0.74009305",
"0.7335228",
"0.7265693",
"0.7248221",
"0.7233685",
"0.7212405",
"0.71671504",
"0.7114317",
"0.70954394",
"0.70858955",
"0.7073204",
"0.7073204",
"0.7015491",
"0.698004",
"0.6977247... | 0.7573106 | 1 |
Tests that search() correctly returns a matching Task given a Task | def test_search(self):
self.task_storage.add(self.my_task)
search_task = task.Task(title='title', notes='note')
task_search_list = self.task_storage.search(search_task)
self.assertTrue(self.my_task in task_search_list) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_not_found(self):\n self.task_storage.add(self.my_task)\n search_task = task.Task(title='title1', notes='note1')\n task_search_list = self.task_storage.search(search_task)\n\n self.assertEqual(task_search_list, None)",
"def test_GET_task_search(self):\n\t\tdata = self.G... | [
"0.75317067",
"0.7350429",
"0.69791824",
"0.69752604",
"0.6914059",
"0.6566952",
"0.64011717",
"0.6261199",
"0.6232779",
"0.6019473",
"0.5957226",
"0.59462476",
"0.59112656",
"0.5889475",
"0.5885827",
"0.5874752",
"0.58672816",
"0.586257",
"0.5858258",
"0.5855104",
"0.5855104... | 0.794454 | 0 |
Tests add()'s handling of failed file reading | def test_add_read_fail(self):
file_handler = open(self.test_task_filename, 'w')
file_handler.write('Mock corrupt data')
file_handler.close()
os.chmod(self.test_task_filename, 000)
self.assertRaises(IOError, self.task_storage.add, self.my_task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_file_append_missing_file(self):\n with (self.assertRaises(IOError)):\n FileWriter(self.bogus_path).append(self.ascii_string)",
"def test_add1(self):\n try:\n TempfileManager.add_tempfile(tempdir + 'add1')\n self.fail(\"Expected IOError because file 'add1' d... | [
"0.7181701",
"0.71707875",
"0.70211554",
"0.67583793",
"0.6626335",
"0.63298345",
"0.63149416",
"0.62887055",
"0.6272493",
"0.62378985",
"0.6216637",
"0.62026274",
"0.6184095",
"0.6158653",
"0.61405927",
"0.6139783",
"0.613846",
"0.6130343",
"0.61097133",
"0.60790586",
"0.607... | 0.73515815 | 0 |
Tests add()'s handling of failed file writing | def test_add_write_fail(self):
os.chmod(self.test_task_filename, 0400)
self.assertRaises(IOError, self.task_storage.add, self.my_task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_file_append_missing_file(self):\n with (self.assertRaises(IOError)):\n FileWriter(self.bogus_path).append(self.ascii_string)",
"def test_add_read_fail(self):\n file_handler = open(self.test_task_filename, 'w')\n file_handler.write('Mock corrupt data')\n file_handle... | [
"0.73165464",
"0.7307308",
"0.7226781",
"0.69408065",
"0.6796736",
"0.6693423",
"0.65727067",
"0.6411899",
"0.6393688",
"0.6373964",
"0.63519084",
"0.63039166",
"0.6282991",
"0.6276873",
"0.6274579",
"0.6184783",
"0.61819637",
"0.61724293",
"0.6146522",
"0.61401504",
"0.61366... | 0.7493461 | 0 |
Tests find()'s handling of failed file reading | def test_find_read_fail(self):
file_handler = open(self.test_task_filename, 'w')
file_handler.write('Mock corrupt data')
file_handler.close()
os.chmod(self.test_task_filename, 000)
self.assertRaises(IOError, self.task_storage.find, self.my_task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_no_file():\n filename = 'asdf'\n with pytest.raises(FileNotFoundError):\n read_file(filename)",
"def test_read_raw_suggested(fname):\n with pytest.raises(ValueError, match='Try reading'):\n read_raw(fname)",
"def test_failures(self):\n reader = TextReader('jacksheet'... | [
"0.69080895",
"0.68955046",
"0.68710303",
"0.67394614",
"0.67348474",
"0.67348474",
"0.6710361",
"0.6645094",
"0.65975255",
"0.6564053",
"0.6531037",
"0.63860875",
"0.63495845",
"0.63137984",
"0.6310357",
"0.63024074",
"0.6291224",
"0.62738997",
"0.62598825",
"0.62516713",
"0... | 0.7037131 | 0 |
Tests get_all()'s handling of failed file reading | def test_get_all_read_fail(self):
file_handler = open(self.test_task_filename, 'w')
file_handler.write('Mock corrupt data')
file_handler.close()
os.chmod(self.test_task_filename, 000)
self.assertRaises(IOError, self.task_storage.get_all) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_iter_files_negative():\n with pytest.raises(ValueError):\n x = list(iter_files(\"wrong_path\", ignore_errors=False))\n assert len(x) > 0\n\n with pytest.raises(RuntimeError):\n x = list(iter_files(\"http://foobar.baz.nonexistent\", ignore_errors=False))\n assert len(x) > ... | [
"0.67754906",
"0.6768293",
"0.66898245",
"0.6532667",
"0.64860004",
"0.6446616",
"0.6441123",
"0.643655",
"0.6398089",
"0.6365367",
"0.63103926",
"0.6277082",
"0.6246861",
"0.61393595",
"0.6119875",
"0.61132956",
"0.6075328",
"0.6074766",
"0.6072406",
"0.60654676",
"0.6059189... | 0.74396557 | 0 |
Tests update()'s handling of failed file writing | def test_update_write_fail(self):
self.task_storage.add(self.my_task)
os.chmod(self.test_task_filename, 0400)
self.assertRaises(IOError, self.task_storage.update, self.my_task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cannot_write_file(self):\n self.api.write_data('/some-fake/path/to-create-file/', 'some-string')",
"def test_file_update_delete_conflict(self):\n dir0, dir1 = self.make_temp_dirs(2)\n self.write_file(dir0, \"foo\", \"bar\")\n self.sync_all()\n\n self.write_file(dir0, \... | [
"0.6860754",
"0.66650736",
"0.643922",
"0.64237213",
"0.6337336",
"0.63254875",
"0.6300389",
"0.6256422",
"0.62026453",
"0.61951196",
"0.61921984",
"0.6148384",
"0.6147777",
"0.61377096",
"0.6131382",
"0.6124437",
"0.6122346",
"0.61113584",
"0.61113584",
"0.61113584",
"0.6094... | 0.7388159 | 0 |
Tests delete()'s handling of failed file writing | def test_delete_write_fail(self):
self.task_storage.add(self.my_task)
os.chmod(self.test_task_filename, 0400)
self.assertRaises(IOError, self.task_storage.delete, self.my_task.key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_file_deleted(self):\n try:\n with get_temp_file() as (fd, name):\n os.unlink(name)\n except Exception as err:\n self.fail('Failed with exception \"{}\"'.format(err))",
"def test_file_update_delete_conflict(self):\n dir0, dir1 = self.make_temp_dir... | [
"0.78282595",
"0.72518045",
"0.72256637",
"0.7099771",
"0.70138484",
"0.6928033",
"0.6867104",
"0.6863741",
"0.6757048",
"0.67564034",
"0.67120224",
"0.6711196",
"0.6697561",
"0.6683005",
"0.6674397",
"0.6671692",
"0.6669273",
"0.6648235",
"0.664784",
"0.6643082",
"0.661105",... | 0.7606043 | 1 |
Tests that update() acts correctly when no note is specified | def test_update_no_note(self):
self.my_task.notes = None
self.my_task.key = self.task_storage.add(self.my_task)
self.my_task.title = 'foo'
key = self.task_storage.update(self.my_task)
new_task = self.task_storage.find(key)
self.assertEqual(self.my_task, new_task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_note(self):\n pass",
"def dummy_update( self ):\r\n pass",
"def test_update_case(self):\n pass",
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_update(self):\n pass",
"def test_update_note(self):\n\n url = rev... | [
"0.8323263",
"0.6799715",
"0.6731598",
"0.6721813",
"0.6721813",
"0.6721813",
"0.66855013",
"0.66341954",
"0.66315436",
"0.6610659",
"0.6530954",
"0.6468007",
"0.6454314",
"0.6421094",
"0.6410134",
"0.64047325",
"0.6364371",
"0.6359656",
"0.6321669",
"0.63181335",
"0.6269567"... | 0.70699596 | 1 |
Tests that get() updates and returns the correct key | def test_get(self):
key = self.key_gen.get()
key2 = self.key_gen.get()
self.assertEqual(key, key2 - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_with_get(self):\n storage = Storage()\n storage.set('1', 1)\n self.assertEqual(1, storage.set('1', 2, get=True), \"Should return previous value\")\n self.assertEqual(2, storage.get('1'), 'Should get new value')\n self.assertEqual(None, storage.set('2', 1, get=True), ... | [
"0.77135766",
"0.7143771",
"0.7143771",
"0.700232",
"0.697707",
"0.6917543",
"0.68096644",
"0.68030596",
"0.68010265",
"0.679268",
"0.6750709",
"0.6750439",
"0.66834974",
"0.66759515",
"0.66249615",
"0.6555398",
"0.65309304",
"0.64803517",
"0.64782",
"0.6461552",
"0.6438102",... | 0.77496535 | 0 |
Tests get()'s handling of failed file writing | def test_get_write_fail(self):
os.chmod(self.test_key_filename, 0400)
self.assertRaises(IOError, self.key_gen.get) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_read_fail(self):\n file_handler = open(self.test_key_filename, 'w')\n file_handler.write('Mock corrupt data')\n file_handler.close()\n os.chmod(self.test_key_filename, 000)\n\n self.assertRaises(IOError, self.key_gen.get)",
"def test_cannot_write_file(self):\n ... | [
"0.7072801",
"0.6922023",
"0.6912302",
"0.66762865",
"0.65602356",
"0.6547754",
"0.6545857",
"0.63780993",
"0.63550174",
"0.6294372",
"0.6274557",
"0.62691563",
"0.6246302",
"0.61645716",
"0.6151025",
"0.61481947",
"0.613047",
"0.60995805",
"0.6093023",
"0.60695434",
"0.60603... | 0.70491755 | 1 |
Get information about past meeting recording | async def fetch_recording(meeting_id: str) -> dict:
return await zoom_service.zoom.get_recording(meeting_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_past_meeting_details(self):\n pass",
"def _parse_past_meetings(self, response):\n meetings = []\n for item in response.css('table.table-striped tbody tr'):\n dt_str = item.css('time::text').extract_first()\n meetings.append({\n 'start': {\n ... | [
"0.61916536",
"0.5642174",
"0.5593307",
"0.5527492",
"0.5521462",
"0.5513049",
"0.54530025",
"0.53965956",
"0.5392502",
"0.5381713",
"0.536658",
"0.52653486",
"0.5265268",
"0.5221127",
"0.5218197",
"0.52050954",
"0.51843894",
"0.51745516",
"0.5103511",
"0.5078141",
"0.5072908... | 0.58373797 | 1 |
Create a new incident priority. | def create_incident_priority(
*,
db_session: Session = Depends(get_db),
incident_priority_in: IncidentPriorityCreate,
):
incident_priority = create(db_session=db_session, incident_priority_in=incident_priority_in)
return incident_priority | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(\n *,\n db_session,\n incident_priority: str,\n incident_type: str,\n reporter_email: str,\n title: str,\n status: str,\n description: str,\n tags: List[dict],\n visibility: str = None,\n) -> Incident:\n # We get the incident type by name\n if not incident_type:\n ... | [
"0.6736081",
"0.6539175",
"0.65382916",
"0.59715176",
"0.5838012",
"0.5808987",
"0.57756734",
"0.57389534",
"0.5729797",
"0.5616003",
"0.5595802",
"0.559525",
"0.5535251",
"0.5528951",
"0.54703873",
"0.54703873",
"0.54703873",
"0.5454121",
"0.54461855",
"0.5445957",
"0.544419... | 0.8211468 | 0 |
Update an existing incident priority. | def update_incident_priority(
*,
db_session: Session = Depends(get_db),
incident_priority_id: int,
incident_priority_in: IncidentPriorityUpdate,
):
incident_priority = get(db_session=db_session, incident_priority_id=incident_priority_id)
if not incident_priority:
raise HTTPException(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def setIncident_priority(\n self,\n eventID: str,\n incidentNumber: int,\n priority: IncidentPriority,\n author: str,\n ) -> None:",
"def setPriority(self, p):\n self.priority = p",
"def update(self, index, priority=-1):\n if (priority == -1):\n ... | [
"0.73270506",
"0.65260607",
"0.64954793",
"0.6305196",
"0.61920965",
"0.61805874",
"0.6173031",
"0.6173031",
"0.6085935",
"0.60838604",
"0.6056914",
"0.6028682",
"0.59914374",
"0.5985253",
"0.5985253",
"0.5985253",
"0.5980391",
"0.5977671",
"0.5963382",
"0.59602666",
"0.59342... | 0.82435286 | 0 |
Get an incident priority. | def get_incident_priority(*, db_session: Session = Depends(get_db), incident_priority_id: int):
incident_priority = get(db_session=db_session, incident_priority_id=incident_priority_id)
if not incident_priority:
raise HTTPException(
status_code=404, detail="The incident priority with this id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_priority(self):\n return self.__priority",
"def _get_priority(self):\n return self.__priority",
"def _get_priority(self):\n return self.__priority",
"def _get_priority(self):\n return self.__priority",
"def priority(self) -> int:\n return pulumi.get(self, \"priority\")",
"def ... | [
"0.71666795",
"0.71666795",
"0.71666795",
"0.71666795",
"0.7143092",
"0.71222526",
"0.71222526",
"0.70545536",
"0.7038056",
"0.7033286",
"0.7033286",
"0.7011243",
"0.6980747",
"0.6961434",
"0.6961434",
"0.6961434",
"0.6961434",
"0.69483155",
"0.6813188",
"0.6794462",
"0.67939... | 0.80712813 | 0 |
"Get run value" Optimization step, run_mem is the memory when running the program with a certain argument, and to get a value we first check if we have it in the running memory, and if not we get it from the "immutable" saved state (self.program) | def __getitem__(self, pos):
try:
return self.run_mem[pos]
except KeyError:
self.run_mem[pos] = self.program[pos]
return self.run_mem[pos] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self, run_number):\n return self[self.run_cache[run_number]]",
"def get_val(self, arg_idx):\n\t\tidx = arg_idx-1\n\t\tif idx >= len(self.__par_modes) or self.__par_modes[idx] == 0:\n\t\t\treturn self.memory[self.memory[self.ptr+arg_idx]]\n\t\telif self.__par_modes[idx] == 1:\n\t\t\treturn self.mem... | [
"0.631511",
"0.6118623",
"0.599009",
"0.58504933",
"0.56327003",
"0.54532564",
"0.54278064",
"0.53919244",
"0.5292854",
"0.52785087",
"0.5211099",
"0.52065086",
"0.5205116",
"0.5199101",
"0.5145069",
"0.51335573",
"0.51126",
"0.51109827",
"0.5099991",
"0.5098417",
"0.50968105... | 0.65592486 | 0 |
For every C function defined in the Complex wrapper section, tell ctypes how to handle its inputs and outputs | def setup_ctypes():
lib.createComplex.argtypes = [ctypes.c_double, ctypes.c_double]
lib.createComplex.restype = ctypes.c_void_p
lib.deleteComplex.argypes = [ctypes.c_void_p]
lib.deleteComplex.restype = None
lib.getRealPart.argypes = [ctypes.c_void_p]
lib.getRealPart.restype = ctypes.c_double
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_capi(lines):\n pattern = r'(\\w+)\\s+(\\**)\\s*(\\w+)\\((.*)\\)' # Float32 *sin(...)\n pexcept = r'except (\\??)(.*)'\n\n functions = []\n for line in lines:\n if line.strip():\n m = re.match(pattern, line)\n restype, stars, fname, argtypes = m.groups()\n ... | [
"0.5993062",
"0.57701015",
"0.5712526",
"0.5676194",
"0.5634198",
"0.54955506",
"0.549056",
"0.54669434",
"0.5429584",
"0.53910625",
"0.5366752",
"0.53551114",
"0.53387433",
"0.53340805",
"0.5324377",
"0.52511126",
"0.52511126",
"0.5248503",
"0.5233666",
"0.51930535",
"0.5190... | 0.68730485 | 0 |
Configure a task logger to generate site and taskspecific logs. | def _setup_task_logger(logger):
if logger.handlers: # Already processed
return
parts = logger.name.split(".")
if len(parts) < 4: # Malformed
return
site = parts[2]
task = parts[3]
_ensure_dirs(os.path.join(_log_dir, site))
formatter = Formatter(
fmt="[%(asctime)s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _configure_logging(self):\n pass",
"def on_celery_setup_logging(**_):\n # underscore is a throwaway-variable, to avoid code style warning for\n # unused variable\n pass",
"def _alter_logger(*args, **kwargs):\n\n # TODO: dress up root logger here under Celery\n # configure_logging()\n ... | [
"0.6633256",
"0.6393813",
"0.6320544",
"0.62959045",
"0.6273784",
"0.6260842",
"0.6259181",
"0.6179772",
"0.61361146",
"0.61344683",
"0.6133988",
"0.6130853",
"0.6126949",
"0.6111299",
"0.61107033",
"0.6107245",
"0.60685533",
"0.60507756",
"0.6001248",
"0.5997276",
"0.5990514... | 0.799023 | 0 |
Set up the logging infrastructure. If log_dir is given, logs will be written to that directory. If quiet is True, logs below ERROR level will not be written to standard error. | def setup_logging(log_dir=None, quiet=False):
global _setup_done
if _setup_done:
return
_setup_done = True
_root.handlers = [] # Remove any handlers already attached
_root.setLevel("DEBUG")
stream = StreamHandler()
stream.setLevel("ERROR" if quiet else "DEBUG")
stream.setForm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_logging(debug=False, quiet=0):\n fmt = '%(asctime)s: %(levelname)-7s: '\n if debug:\n fmt += '%(filename)s:%(funcName)s: '\n fmt += '%(message)s'\n\n # 'Sat, 05 Oct 2013 18:58:50 -0400 (EST)'\n datefmt = '%a, %d %b %Y %H:%M:%S %z'\n tzname = time.strftime('%Z', time.localtime())\... | [
"0.71798515",
"0.6696411",
"0.66884494",
"0.66336703",
"0.6422789",
"0.6404984",
"0.629583",
"0.62205315",
"0.6207769",
"0.60925233",
"0.60813147",
"0.60172576",
"0.6015258",
"0.6000806",
"0.5992214",
"0.5985083",
"0.5964345",
"0.59621847",
"0.5936569",
"0.59219706",
"0.59153... | 0.80954593 | 0 |
Runs a shell command and returns the output. | def run_shell_command(command, checkReturnValue=True, verbose=False):
process = subprocess.Popen(
command,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
bufsize=1)
outText = ""
for line in iter(process.stdout.readline,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_command(shell_command, get_output):\n command_ran = subprocess.run(shell_command, capture_output=get_output)\n return command_ran",
"def _run_shell(self, cmd):\n self._logger.info(\"Running command\\n{}\".format(\" \".join(cmd)))\n\n out = subprocess.Popen(\n cmd,\n ... | [
"0.8129673",
"0.76473814",
"0.762463",
"0.7579825",
"0.75197285",
"0.7503632",
"0.7502268",
"0.74991596",
"0.74890614",
"0.74848115",
"0.7482531",
"0.7450168",
"0.7447455",
"0.7440299",
"0.7410105",
"0.74087685",
"0.7403609",
"0.7398195",
"0.73907506",
"0.73829544",
"0.736797... | 0.7687183 | 1 |
Conveinence function to write text to a file at specified path | def txtWrite(text, path, mode="w"):
dirMake(os.path.dirname(path))
textFile = open(path, mode)
textFile.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(cls, path, text):\n with cls.open(path, 'wt') as fd:\n return fd.write(text)",
"def save_file(path, text):\n with path.open(mode='w') as f_stream:\n f_stream.write(text)",
"def writefile(path: Union[str, Path], txt: str) -> None:\n with open(path, 'w') as outfile:\n ... | [
"0.8543954",
"0.8357027",
"0.8341502",
"0.8121914",
"0.8031457",
"0.7922882",
"0.7885296",
"0.7877682",
"0.7796177",
"0.76735586",
"0.76676124",
"0.7660709",
"0.7648635",
"0.76421416",
"0.76414704",
"0.75855273",
"0.7556236",
"0.7516805",
"0.7516794",
"0.75154793",
"0.7488664... | 0.83784384 | 1 |
Write sitk image to path. | def imgWrite(img, path):
dirMake(os.path.dirname(path))
sitk.WriteImage(img, path)
# Reformat files to be compatible with CIS Software
#ext = os.path.splitext(path)[1].lower()
#if ext == ".vtk": vtkReformat(path, path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(img, path):\n create_directories_for_file_name(path)\n writer = sitk.ImageFileWriter()\n writer.Execute(img, path, True)",
"def write_image(self, name: str, image_path: str):\n # TODO: implement\n raise NotImplementedError(\"We are working on this!\")",
"def write(self, uri):\n... | [
"0.82689285",
"0.69438845",
"0.6797211",
"0.67003214",
"0.665736",
"0.6627939",
"0.6531617",
"0.65256447",
"0.64676696",
"0.6366418",
"0.6359249",
"0.63326037",
"0.63315624",
"0.6317838",
"0.6264821",
"0.62386143",
"0.6221924",
"0.61992943",
"0.6194874",
"0.6182149",
"0.61810... | 0.78326446 | 1 |
Reformats vtk file so that it can be read by CIS software. | def vtkReformat(inPath, outPath):
# Get size of map
inFile = open(inPath,"rb")
lineList = inFile.readlines()
for line in lineList:
if line.lower().strip().startswith("dimensions"):
size = map(int,line.split(" ")[1:dimension+1])
break
inFile.close()
if dimension =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vF3d_VTK(field,name,VTKformat): \n if VTKformat == 'vtu':\n vf3d_vtu(field,name)\n elif VTKformat == None:\n print 'Please select a VTK format'\n else:\n print 'The selected format has not been developed yet'\n return #nothing, since functions output the written VTK file",
"d... | [
"0.62193173",
"0.57385737",
"0.5709972",
"0.5686796",
"0.5682545",
"0.56288266",
"0.5449302",
"0.5447128",
"0.5324145",
"0.5320638",
"0.52094007",
"0.51937026",
"0.51830435",
"0.5158508",
"0.5067943",
"0.5041662",
"0.50389045",
"0.5018575",
"0.49896502",
"0.4977766",
"0.49741... | 0.690809 | 0 |
Send out Pokemon to fill out all pkmnInPlay at the start of a battle | def sendOutPkmnAtStart(self):
messages = []
for i in range(0, len(self.pkmnInPlay)):
pkmn = self.trainer.getPokemon(i)
if not pkmn:
break
messages += self.pkmnInPlay[i].sendOutPkmn(pkmn)
return messages | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_capturing(self):\n self.socket.sendall(pack('B', codes['request_pokemon']))\n self.receive_pokemon_suggestion()",
"async def loadpokemon(self, ctx):\n await self.bot.di.new_items(ctx.guild, (ServerItem(**item) for item in self.bot.pokemonitems.values()))\n await ctx.send(a... | [
"0.67078197",
"0.63009113",
"0.62193114",
"0.6155208",
"0.6047284",
"0.58103806",
"0.5721495",
"0.5694783",
"0.56641287",
"0.5642981",
"0.5624466",
"0.55981576",
"0.55663645",
"0.5546739",
"0.5529542",
"0.55240864",
"0.5524027",
"0.54824936",
"0.5482483",
"0.5477886",
"0.5476... | 0.6804697 | 0 |
Returns whether this side has more Pokemon | def hasPokemon(self):
return self.trainer.hasPokemon() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasMorePokemon(self):\r\n return self.trainer.hasMorePokemon(self.pkmnInPlay)",
"def verify_winner(self):\r\n return self.count_pegs() == 1",
"def game_over(self):\n return self.lives() < 0",
"def is_game_over(self):\n\n if len(self.next_pieces) == 0:\n return True"... | [
"0.86962175",
"0.66944605",
"0.6432077",
"0.6378804",
"0.62600136",
"0.6254641",
"0.6234091",
"0.6170001",
"0.6144419",
"0.6124276",
"0.6100488",
"0.6029803",
"0.60084647",
"0.6006607",
"0.60016185",
"0.599479",
"0.59779173",
"0.5945332",
"0.59220695",
"0.5919824",
"0.5894156... | 0.72014064 | 1 |
Returns whether this side has more Pokemon | def hasMorePokemon(self):
return self.trainer.hasMorePokemon(self.pkmnInPlay) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasPokemon(self):\r\n return self.trainer.hasPokemon()",
"def verify_winner(self):\r\n return self.count_pegs() == 1",
"def game_over(self):\n return self.lives() < 0",
"def is_game_over(self):\n\n if len(self.next_pieces) == 0:\n return True",
"def check_win(self... | [
"0.72014064",
"0.66944605",
"0.6432077",
"0.6378804",
"0.62600136",
"0.6254641",
"0.6234091",
"0.6170001",
"0.6144419",
"0.6124276",
"0.6100488",
"0.6029803",
"0.60084647",
"0.6006607",
"0.60016185",
"0.599479",
"0.59779173",
"0.5945332",
"0.59220695",
"0.5919824",
"0.5894156... | 0.86962175 | 0 |
Takes a single column h2o frame and converts it into a numpy array | def _as_numpy(_1d_h2o_frame):
f = _check_is_1d_frame(_1d_h2o_frame)
nm = str(f.columns[0])
return f[nm].as_data_frame(use_pandas=True)[nm].values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_numpy_array(self):\n return self.frame",
"def to_numpy(self) -> np.ndarray:\n return self.frame",
"def df_to_array(datasample):\r\n return np.array(datasample)",
"def get_2Darray_hdf5(file,cols='Null',nrows='Null',verbose=False):\n if verbose:\n print (\"reading data from hd... | [
"0.64757276",
"0.64702165",
"0.64014775",
"0.6242585",
"0.6235455",
"0.62248886",
"0.6215187",
"0.6193573",
"0.60600567",
"0.60081595",
"0.5974779",
"0.5886654",
"0.5854119",
"0.5842756",
"0.57685006",
"0.5767864",
"0.57593876",
"0.5755051",
"0.5754591",
"0.5703501",
"0.57018... | 0.8304878 | 0 |
Construct a firecrest object | def test_firecrest(self):
f = firecrest.firecrest(self.firecrest_dir)
self.assertEqual(f.software, 'Firecrest')
self.assertEqual(f.version, '1.8.28')
self.assertEqual(f.start, 1)
self.assertEqual(f.stop, 33)
self.assertEqual(f.user, 'diane')
self.assertEqual(f.dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_constructor(self):\n pass",
"def test_create(self):\n filter = Bleach()\n self.assertIsInstance(filter, Bleach)",
"def test_create_from_pear(self):\n pass",
"def test_constructors(self, name, obj):\n assert getattr(forge, name) == obj",
"def test_constructors(sel... | [
"0.6093629",
"0.5956207",
"0.5937157",
"0.58960754",
"0.58960754",
"0.56730235",
"0.5631295",
"0.5618941",
"0.56151974",
"0.5607867",
"0.5604231",
"0.5564176",
"0.5553448",
"0.5520033",
"0.5516942",
"0.549883",
"0.54632604",
"0.545859",
"0.54328346",
"0.5432628",
"0.5422888",... | 0.71082515 | 0 |
construct a bustard object | def test_bustard(self):
b = bustard.bustard(self.bustard_dir)
self.assertEqual(b.software, 'Bustard')
self.assertEqual(b.version, '1.8.28')
self.assertEqual(b.date, date(2008,4,12))
self.assertEqual(b.user, 'diane')
self.assertEqual(len(b.phasing), 8)
self.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__ (self, pseudo, bag, position, jeu):\n self.pseudo = pseudo\n self.bag = bag\n self.position = position\n self.jeu = jeu",
"def __init__(self, length, breadth, height, producingAPI):\n\n\t\tself.length = length\n\t\tself.breadth = breadth\n\t\tself.height = height\n\n\t\ts... | [
"0.61758626",
"0.6070561",
"0.6049549",
"0.5977584",
"0.59720093",
"0.5921451",
"0.59111565",
"0.5895199",
"0.58890486",
"0.584525",
"0.58363193",
"0.5829075",
"0.58265615",
"0.5792226",
"0.57836425",
"0.570507",
"0.5696389",
"0.56958777",
"0.56604916",
"0.5656449",
"0.565638... | 0.6578043 | 0 |
Initialize an instance of BpMainWindow. | def __init__(self, parent=None):
# Inherited from QMainWindow
if sys.platform == 'darwin':
# Workaround for Qt issue on OS X that causes QMainWindow to
# hide when adding QToolBar, see
# https://bugreports.qt-project.org/browse/QTBUG-4300
super(BpMainWindo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, parent=None):\n super(MainWindow, self).__init__(parent)\n self.setupUi(self)\n \n self.setWindowTitle(\"RPI HMI - pH Debug\") # Title creation",
"def __init__(self, parent=None):\n super(MainWindow, self).__init__(parent)\n self.setupUi(self)",
... | [
"0.7311495",
"0.73000187",
"0.73000187",
"0.73000187",
"0.73000187",
"0.73000187",
"0.7089863",
"0.6971019",
"0.6952852",
"0.68420416",
"0.6827273",
"0.68243486",
"0.68117946",
"0.6794219",
"0.6791741",
"0.6789436",
"0.6737455",
"0.673218",
"0.6706583",
"0.66974556",
"0.66848... | 0.7458744 | 0 |
Get label config file. | def _get_label_config(self, file_path):
# Get label config file
dir = os.path.dirname(file_path)
file = os.path.basename(file_path)
split_list = file.split('.')
nii_index = split_list.index('nii')
file = ''.join(split_list[:nii_index])
config_file = os.path.join(f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_label_config(self):\n return self.label_config_center",
"def get(self, label):\n if label in self.config[self.env]:\n return self.config[self.env][label]\n else:\n logging.warning(f'Config Mgr->get(): label: {label} not configured')\n return None",
... | [
"0.71112484",
"0.6886209",
"0.67283285",
"0.66105795",
"0.655368",
"0.6528876",
"0.6489148",
"0.62944597",
"0.62603927",
"0.61917907",
"0.618969",
"0.6151914",
"0.6135884",
"0.60983557",
"0.60794586",
"0.6058079",
"0.597896",
"0.5976467",
"0.594677",
"0.59456503",
"0.5944229"... | 0.8079704 | 0 |
Choose winning behavior. Returns | def choose_action(self, active_behaviors):
winning_behavior = active_behaviors[0]
for behavior in active_behaviors:
print('Checking behavior:', behavior, 'with weight:', behavior.weight)
if behavior.weight > winning_behavior.weight:
winning_behavior = behavior
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_win_game(self):\r\n win_game_anims =['anim_speedtap_winround_intensity01_01',\r\n 'anim_speedtap_winround_intensity02_02',\r\n 'anim_speedtap_winround_intensity02_01',\r\n 'anim_speedtap_wingame_intensity02_01',\r\n ... | [
"0.69298387",
"0.6927804",
"0.67378783",
"0.6535386",
"0.6518367",
"0.6518367",
"0.6518367",
"0.6459356",
"0.6443634",
"0.6269449",
"0.625524",
"0.62198985",
"0.6202906",
"0.61732984",
"0.6137767",
"0.613293",
"0.61287475",
"0.6128412",
"0.6127908",
"0.61184627",
"0.60811716"... | 0.75507355 | 0 |
Create the purchase order from the procurement, using the provided field values, after adding the given purchase order line in the purchase order. | def create_procurement_purchase_order(self, cr, uid, procurement, po_vals, line_vals, context=None):
line_vals.update({'name': ''})
po_vals.update({'order_line': [(0,0,line_vals)]})
return self.pool.get('purchase.order').create(cr, uid, po_vals, context=context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _action_procurement_create(self):\n precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')\n new_procs = self.env['procurement.order'] #Empty recordset\n for line in self:\n if line.state != 'sale' or not line.product_id._need_procurement():\n ... | [
"0.6888037",
"0.65397227",
"0.63925135",
"0.6348369",
"0.6280681",
"0.6279953",
"0.6240536",
"0.619458",
"0.6017149",
"0.5950889",
"0.59003526",
"0.58743674",
"0.5850543",
"0.58399665",
"0.5826049",
"0.57910156",
"0.5758798",
"0.57562804",
"0.57397044",
"0.57277566",
"0.57269... | 0.7962728 | 0 |
Print out instructions for users to initialize shell support. | def shell_init_instructions(cmd, equivalent):
shell_specific = "{sh_arg}" in equivalent
msg = [
"`%s` requires Spack's shell support." % cmd,
"",
"To set up shell support, run the command below for your shell.",
"",
color.colorize("@*c{For bash/zsh/sh:}"),
" . ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def help_shell(self):\n help_str = \"\"\"Execute a command as if at the OS prompt.\n\n Usage: shell cmd\"\"\"\n self.stdout.write(\"{}\\n\".format(help_str))",
"def shell():\n pass",
"def main_menu_for_testing():\n print(PROMPT_TEXT)",
"def shell(self, **options):\n pass",
"d... | [
"0.69160414",
"0.6561335",
"0.63099104",
"0.61669785",
"0.6131323",
"0.6127535",
"0.60904056",
"0.6050623",
"0.6006464",
"0.5993894",
"0.5986725",
"0.594844",
"0.5937397",
"0.59171444",
"0.5916378",
"0.5912071",
"0.59116024",
"0.5891829",
"0.5866645",
"0.5843955",
"0.5842719"... | 0.7073582 | 0 |
Get all the media files from the timeline. | def get_media(api, num_tweets=25, profile="@hakeemangulu", admin=False):
# Store the media urls in a list
media_files = []
# Create cursor object for the timeline
if admin:
# If the admin is using the application, return his timeline
tl = tweepy.Cursor(api.home_timeline).items(num_tweet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMediaFiles(path):\n fileList = getMediaFileList(path)\n # dirList = getDirectoryList(path)\n\n # results = map(getMediaFiles, dirList)\n\n # for result in results:\n # fileList = fileList + result\n\n return fileList",
"def get_list(self ):\n headers = { 'Authorization' : self.c... | [
"0.7197177",
"0.6829401",
"0.6617265",
"0.65482754",
"0.6439673",
"0.6379388",
"0.6306178",
"0.6199665",
"0.6124367",
"0.6110009",
"0.6092357",
"0.5991812",
"0.5875019",
"0.5816229",
"0.5801913",
"0.5788004",
"0.5765499",
"0.57631904",
"0.57608795",
"0.5754463",
"0.57203853",... | 0.70954514 | 1 |
A combination of the get_media and downloader functions, thus finding the media then downloading it in one call. | def get_and_download(api, path, num_tweets=25, profile="@hakeemangulu", admin=False):
return downloader(get_media(api, num_tweets, profile, admin), path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _get_remote_media_impl(\n self, server_name: str, media_id: str\n ) -> Tuple[Optional[Responder], dict]:\n media_info = await self.store.get_cached_remote_media(server_name, media_id)\n\n # file_id is the ID we use to track the file locally. If we've already\n # seen the fi... | [
"0.6771369",
"0.67361933",
"0.6502162",
"0.63834363",
"0.63795763",
"0.6263145",
"0.6207519",
"0.61159295",
"0.60781926",
"0.606364",
"0.60588175",
"0.59851134",
"0.5968101",
"0.59372675",
"0.5937135",
"0.59367",
"0.5936326",
"0.59268355",
"0.59197426",
"0.5913188",
"0.587109... | 0.68603694 | 0 |
Given a unique string 'job', connect to Redis and look at the Sorted Set which holds the results for that job. Take the top 5 and report them into the report key store. | def report_to_redis(job, count=5):
# it's important that these main python methods
# don't call the Singleton - _connection needs to be None to be
# properly serialized.
r = StrictRedis.from_url("redis://10.0.0.10:6379")
for i in range(count):
res = r.zpopmax('temp0')
print(res)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getjobsbydatabase(self):\n select_jobsbydb = (\n \"SELECT count(*), database FROM jobs \"\n \"WHERE latestjobversion=True AND insertdate BETWEEN %s AND %s \"\n \"AND (username NOT IN (%s)) GROUP BY database\"\n )\n\n self.pgcursor.execute(select_jobsbydb, (... | [
"0.56763387",
"0.5650112",
"0.55427843",
"0.55423814",
"0.537743",
"0.52602905",
"0.52289313",
"0.52130634",
"0.52130085",
"0.5157604",
"0.50683767",
"0.5059203",
"0.50033915",
"0.49904054",
"0.49861166",
"0.4960205",
"0.4941266",
"0.49406096",
"0.49334633",
"0.48996183",
"0.... | 0.7382193 | 0 |
Given a list of tags, return the set of keys common to all the tags, if common is set to true. Return the Union if it is set to false. | def retrieve_keys(tags, common=True):
r = StrictRedis.from_url('redis://10.0.0.10:6379')
# if tags exist, filter them (later)
# print(tags)
if tags == []:
return []
else:
print('FILTERING')
if common:
available_keys = set([])
else:
available_ke... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_intersection(intersection_list):\n intersection_keys = set()\n for ij in intersection_list:\n if len(intersection_keys) == 0:\n intersection_keys = set(ij)\n else:\n intersection_keys = intersection_keys.union(set(ij))\n return intersection_keys",
"def c... | [
"0.633568",
"0.61055833",
"0.6078032",
"0.607099",
"0.6065052",
"0.60457534",
"0.5982037",
"0.59574974",
"0.5949828",
"0.59448105",
"0.59397596",
"0.5928033",
"0.591519",
"0.59143674",
"0.58971894",
"0.5877742",
"0.5863845",
"0.5802865",
"0.5800691",
"0.5798681",
"0.5798681",... | 0.691533 | 0 |
Send the new colors for each vertex to the GPU. This method must set the contents of `self._vertex_list.colors` using a list or tuple that contains the RGBA color components for each vertex in the shape. This is usually done by repeating `self._rgba` for each vertex. | def _update_color(self):
self._vertex_list.colors[:] = self._rgba * self._num_verts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def color_vertices(obj, vert_ind, colors):\n thisfunc = thisfile + '->color_vertices()'\n\n # Validate inputs\n if isinstance(vert_ind, int):\n vert_ind = [vert_ind]\n if isinstance(colors, tuple):\n colors = [colors] * len(vert_ind)\n assert (len(colors) == len(vert_ind)), \\\n ... | [
"0.66109",
"0.63820016",
"0.61168706",
"0.59581137",
"0.5888359",
"0.577895",
"0.57686615",
"0.57098585",
"0.5686346",
"0.56688666",
"0.56354624",
"0.5607529",
"0.5606135",
"0.5555189",
"0.5537485",
"0.5527043",
"0.5501716",
"0.5500356",
"0.5498688",
"0.54671127",
"0.543129",... | 0.79452085 | 0 |
Build internal vertex list. This method must create a vertex list and assign it to `self._vertex_list`. It is advisable to use it during `__init__` and to then update the vertices accordingly with `self._update_vertices`. While it is not mandatory to implement it, some properties ( namely `batch` and `group`) rely on t... | def _create_vertex_list(self):
raise NotImplementedError('_create_vertex_list must be defined in '
'order to use group or batch properties') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_vertices(self):\n self.vertices = []\n for key in self.graph:\n self.vertices.append(self.Vertex(key, self.graph[key]))",
"def _generate_vertexes(self):\n # generate list of sets for each vms\n self._graph = [set() for _ in range(self._vm_count)]",
"def populate_... | [
"0.701082",
"0.66579324",
"0.6513389",
"0.64290905",
"0.61587995",
"0.6149416",
"0.6126646",
"0.60945904",
"0.6051399",
"0.5948048",
"0.59308505",
"0.5899427",
"0.585141",
"0.5845312",
"0.5817854",
"0.5809941",
"0.58075523",
"0.57637733",
"0.57617563",
"0.5758524",
"0.5758283... | 0.8401217 | 0 |
Generate uptodate vertex positions & send them to the GPU. This method must set the contents of `self._vertex_list.vertices` using a list or tuple that contains the new vertex coordinates for each vertex in the shape. See the `ShapeBase` subclasses in this module for examples of how to do this. | def _update_vertices(self):
raise NotImplementedError("_update_vertices must be defined"
"for every ShapeBase subclass") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_vertex_list(self):\n raise NotImplementedError('_create_vertex_list must be defined in '\n 'order to use group or batch properties')",
"def populate_vertices(self, vertices_list):\n vertices = []\n for vertex in vertices_list:\n vertex_... | [
"0.685211",
"0.66294765",
"0.63282067",
"0.6211691",
"0.61160797",
"0.5978315",
"0.59519964",
"0.59514546",
"0.58506083",
"0.583711",
"0.582701",
"0.58230495",
"0.57949495",
"0.5790536",
"0.57774246",
"0.5764628",
"0.5744858",
"0.573755",
"0.57267916",
"0.5708336",
"0.5698905... | 0.74700004 | 0 |
The X coordinate of the anchor point | def anchor_x(self):
return self._anchor_x | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_x(self):\n return self.posX",
"def _get_x(self):\n return self.position.x",
"def get_x_position(self):\n return self.rect.x",
"def get_x_position(self):\n return self.actual_coordinates[0]",
"def get_x(self):\n return self.coords[0]",
"def get_pos_x(self):\n ... | [
"0.7760154",
"0.7716742",
"0.7668874",
"0.7646122",
"0.7621986",
"0.7559974",
"0.7516883",
"0.75067914",
"0.74623626",
"0.7436206",
"0.74320745",
"0.73874915",
"0.7360508",
"0.7344753",
"0.7308688",
"0.73033357",
"0.724241",
"0.7212631",
"0.71839815",
"0.7164864",
"0.7118556"... | 0.90373385 | 0 |
The Y coordinate of the anchor point | def anchor_y(self):
return self._anchor_y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_y(self):\n return self.position.y",
"def get_y_position(self):\n return self.actual_coordinates[1]",
"def y(self):\r\n return self.position.y",
"def get_y_position(self): \n return self.rect.y",
"def get_alien_y(self):\n return self.y",
"def get_y(self):\n\t... | [
"0.7840486",
"0.775186",
"0.775122",
"0.77391493",
"0.7671916",
"0.7608013",
"0.7590078",
"0.75695264",
"0.74748814",
"0.7469654",
"0.74505246",
"0.7402634",
"0.74024355",
"0.737545",
"0.73700285",
"0.73483944",
"0.7334472",
"0.7331511",
"0.73242426",
"0.72643715",
"0.7259252... | 0.8872084 | 0 |
The (x, y) coordinates of the anchor point, as a tuple. | def anchor_position(self):
return self._anchor_x, self._anchor_y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xy(self) -> Tuple[float, float]:\n return (self.x, self.y)",
"def coordinates(self) -> Tuple[int, int]:\n return self.x, self.y",
"def coordinates(self) -> Tuple[float, float, float, float, float]:\n return (self.x, self.y, self.x + self.width, self.y + self.height)",
"def xy(self) -... | [
"0.76912844",
"0.76704925",
"0.75844866",
"0.757345",
"0.75154847",
"0.73809236",
"0.7226224",
"0.70824313",
"0.7065255",
"0.70325917",
"0.70245636",
"0.69454324",
"0.69359416",
"0.6896294",
"0.68918604",
"0.68812925",
"0.68750954",
"0.6868717",
"0.6834308",
"0.6834308",
"0.6... | 0.7830221 | 0 |
Blend opacity. This property sets the alpha component of the color of the shape. With the default blend mode (see the constructor), this allows the shape to be drawn with fractional opacity, blending with the background. An opacity of 255 (the default) has no effect. An opacity of 128 will make the shape appear translu... | def opacity(self):
return self._rgba[3] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _opacity(self):\n item = self.item()\n return 255 if item is None else item.getColor().alpha()",
"def opacity(im,alpha):\n if im.mode != 'RGBA':\n im = im.convert('RGBA')\n else:\n im = im.copy()\n alphachannel = im.split()[3]\n alphachannel = ImageEnhance.Brightness(a... | [
"0.5919304",
"0.58347225",
"0.5765835",
"0.56959087",
"0.56722987",
"0.56599414",
"0.5651657",
"0.5604866",
"0.56035215",
"0.5593729",
"0.5592929",
"0.55849886",
"0.55826104",
"0.5575257",
"0.5568694",
"0.5568251",
"0.5501839",
"0.5460512",
"0.5455902",
"0.5431659",
"0.536440... | 0.5972214 | 0 |
The start angle of the arc. | def start_angle(self):
return self._start_angle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(self):\n return arccos(dot((self.a - self.o) / self.r, (self.b - self.o) / self.r))",
"def angle(self):\n return 0",
"def angle(self) -> float:\n ...",
"def angle(self) -> float:\n return self._angle",
"def angle(self) -> float:\n return self._angle",
"def ang... | [
"0.7364975",
"0.7243839",
"0.7123329",
"0.7072685",
"0.7072685",
"0.7015025",
"0.7015025",
"0.7015025",
"0.69397306",
"0.6842029",
"0.6822126",
"0.6776148",
"0.66612154",
"0.6619934",
"0.66096723",
"0.6608768",
"0.6604382",
"0.6560013",
"0.6542135",
"0.6500179",
"0.64864135",... | 0.8060585 | 0 |
The radius of the circle. | def radius(self):
return self._radius | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def radius(self) -> float:\n return self._radius",
"def getRadius(self):\n return self.radius",
"def getRadius(self):\n return self.__radius",
"def get_radius(self):\n return self.R",
"def radius(self) -> Union[int, float]:\n return self.proto.radius",
"def get_radius(s... | [
"0.88121676",
"0.8728803",
"0.8715825",
"0.8557909",
"0.8500211",
"0.8490493",
"0.8431619",
"0.83906394",
"0.8388057",
"0.8369628",
"0.8369628",
"0.8269019",
"0.82527936",
"0.8229431",
"0.8172032",
"0.80954605",
"0.80517036",
"0.79516727",
"0.7894692",
"0.78869784",
"0.788449... | 0.8809348 | 1 |
The start angle of the sector. | def start_angle(self):
return self._start_angle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(self):\n return 0",
"def angle(self) -> float:\n ...",
"def angle(self):\n return self._angle",
"def angle(self):\n return self._angle",
"def angle(self):\n return self._angle",
"def angle(self) -> float:\n return self._angle",
"def angle(self) -> flo... | [
"0.732036",
"0.70946956",
"0.7063976",
"0.7063976",
"0.7063976",
"0.6993282",
"0.6993282",
"0.6937274",
"0.679846",
"0.67892903",
"0.6756747",
"0.673555",
"0.6734926",
"0.6668017",
"0.66629857",
"0.6628418",
"0.65350014",
"0.6508508",
"0.6504248",
"0.64290774",
"0.64239025",
... | 0.79691404 | 1 |
The rectangle's border color. This property sets the color of the border of a bordered rectangle. The color is specified as an RGB tuple of integers '(red, green, blue)' or an RGBA tuple of integers '(red, green, blue, alpha)`. Setting the alpha on this property will change the alpha of the entire shape, including both... | def border_color(self):
return self._border_rgba | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def border_color(self):\n if self.has_border:\n return Color(self._border_actor.GetProperty().GetColor())\n return None",
"def border_color(self) -> int:\n return self._border_color",
"def borderColor( self ):\n return self._borderColor",
"def set_border(self, color: tu... | [
"0.70855075",
"0.6881495",
"0.65604347",
"0.6481082",
"0.63925225",
"0.62421936",
"0.5909977",
"0.58470607",
"0.58169484",
"0.58093",
"0.5666582",
"0.5656656",
"0.5656656",
"0.56459826",
"0.5612554",
"0.54604846",
"0.54521537",
"0.54230624",
"0.54169893",
"0.5317806",
"0.5285... | 0.72605103 | 0 |
Third X coordinate of the shape. | def x3(self):
return self._x + self._x3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def x(self):\n return self.coords[0]",
"def get_x(self):\n return self.coords[0]",
"def x(self):\n return self._coords[0]",
"def get_x(self):\n return self.posX",
"def _get_x(self):\n return self.position.x",
"def x(self):\n return _libsbml.Point_x(self)",
"def... | [
"0.70563585",
"0.6986707",
"0.6912074",
"0.67736113",
"0.66708046",
"0.6601498",
"0.6595005",
"0.65564144",
"0.654688",
"0.646505",
"0.64605474",
"0.64541453",
"0.6450418",
"0.6446166",
"0.64437145",
"0.64261997",
"0.64108616",
"0.64108616",
"0.6409632",
"0.63983107",
"0.6397... | 0.70080376 | 1 |
Third Y coordinate of the shape. | def y3(self):
return self._y + self._y3 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y(self):\n return self.coords[1]",
"def get_y(self):\n return self.coords[1]",
"def y(self):\n return self._coords[1]",
"def getY(self):\n return self.position[1]",
"def getY(self):\n return self.components[1]",
"def getY(self):\n return self.components[1]",
... | [
"0.7237422",
"0.7184859",
"0.7050024",
"0.7018006",
"0.69789183",
"0.69789183",
"0.6907676",
"0.68496335",
"0.6797792",
"0.67078674",
"0.6696344",
"0.6619756",
"0.66165763",
"0.6595526",
"0.6586894",
"0.65845793",
"0.6581554",
"0.6558877",
"0.6552422",
"0.65516716",
"0.654140... | 0.80560815 | 0 |
The outer radius of the star. | def outer_radius(self):
return self._outer_radius | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inner_radius(self):\n return self._inner_radius",
"def get_radius(self):\n return self.R",
"def get_radius(self):\r\n return 1",
"def get_radius(self):\n return self.r",
"def radius(self):\n return sqrt(self.radius_square())",
"def radius(self) -> int:\n pass... | [
"0.7974437",
"0.7683473",
"0.76440513",
"0.75512946",
"0.7493376",
"0.7478774",
"0.74299973",
"0.7410966",
"0.7409471",
"0.7294475",
"0.7293487",
"0.7293487",
"0.7293487",
"0.7293487",
"0.7293487",
"0.72553426",
"0.72553426",
"0.7249025",
"0.72409123",
"0.7231385",
"0.722837"... | 0.8559289 | 0 |
The inner radius of the star. | def inner_radius(self):
return self._inner_radius | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def outer_radius(self):\n return self._outer_radius",
"def get_radius(self):\n return self.R",
"def get_radius(self):\r\n return 1",
"def get_radius(self):\n return self.r",
"def radius(self):\n return sqrt(self.radius_square())",
"def radius_square(self):\n try:... | [
"0.80226016",
"0.7799017",
"0.77007794",
"0.7670528",
"0.7602944",
"0.75848025",
"0.7573816",
"0.75393444",
"0.74344003",
"0.7425558",
"0.7412033",
"0.73999923",
"0.73999923",
"0.73999923",
"0.73999923",
"0.73999923",
"0.73865736",
"0.73805606",
"0.73805606",
"0.7353282",
"0.... | 0.8454345 | 0 |
Number of spikes of the star. | def num_spikes(self):
return self._num_spikes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_spikes(self):\n return self.model.n_spikes",
"def numberOfPoints(self):\n return 20000",
"def count_spikes(spk):\n shspk = numpy.shape(spk)\n if len(shspk) == 0:\n nspk = 0\n elif shspk[0] == 0:\n nspk = 0\n else:\n nspk = shspk[0]\n return(nspk)",
"def... | [
"0.68215555",
"0.6694392",
"0.6427395",
"0.62704337",
"0.6255422",
"0.6169472",
"0.6124636",
"0.6118094",
"0.61015534",
"0.6085608",
"0.6085608",
"0.6085608",
"0.6085608",
"0.6058355",
"0.60444564",
"0.60277",
"0.60111445",
"0.59934705",
"0.59934705",
"0.59739375",
"0.5970636... | 0.71719515 | 0 |
Returns the workspace container as determined by the settings. | def getTargetContainer(self):
settings = zope.component.getUtility(IPMR2GlobalSettings)
if settings.create_user_workspace:
uwc = settings.getCurrentUserWorkspaceContainer()
if uwc is not None:
return uwc
# Otherwise return the global workspace container... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_workspace(client):\n return client._creoson_post(\"windchill\", \"get_workspace\", key_data=\"workspace\")",
"def get_workspace(client):\n workspace = getattr(settings, 'ASANA_WORKSPACE', None)\n if not workspace:\n workspaces = [\n workspace for workspace in client.workspaces.... | [
"0.7000218",
"0.683348",
"0.6810205",
"0.6738207",
"0.67233706",
"0.6647305",
"0.6563112",
"0.6479329",
"0.6458167",
"0.6424094",
"0.6359544",
"0.63457716",
"0.63282126",
"0.6298409",
"0.6236829",
"0.6234185",
"0.622422",
"0.61569285",
"0.6118726",
"0.60800993",
"0.60078186",... | 0.7890182 | 0 |
If the QuoteItems has nothing joined to it, then I'll go through and actually delete the record from the system, otherwise, I'll just mark the record deleted. | def QuoteItemsDel(Id, id='', **kw):
if id != '':
Id = id
if Id != '':
try:
int_id = int(Id)
record = model.InvQuoteItems.get(int_id)
except (ValueError, SQLObjectNotFound):
int_id = -1
else:
int_id = -1
try:
if int_id > 0:
#No references for these objects, so I'll delete completely
reco... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete(self):\n\n\t\titem_id = mock_item()[0]\n\t\tmodels.delete(item_id)\n\n\t\titem = models.item(item_id)\n\t\tself.assertIsNone(item)",
"def clear(self):\r\n self.orderitem_set.all().delete()",
"def delete(self):\n return self.items.delete(item_id=self.id)",
"def test_delete_item_u... | [
"0.6471906",
"0.6318868",
"0.6103051",
"0.61027896",
"0.6094735",
"0.60656655",
"0.5921691",
"0.5912371",
"0.59087306",
"0.5865899",
"0.5856185",
"0.58085054",
"0.5731289",
"0.57115304",
"0.57032573",
"0.5684151",
"0.56772625",
"0.56723213",
"0.56496936",
"0.5649413",
"0.5625... | 0.6537003 | 0 |
Return a dict where keys are setup wizard step names, and the values the form class matching the step. | def get_setup_forms(self, wizard):
return {} # pragma: no cover | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_form_classes(self):\n return {\n **self.form_classes\n }",
"def _collect_kwargs(step):\n dicts = {}\n for s in _expand_inputs(step):\n name = s.name if s.name is not None else s.__class__.__name__\n if name in dicts.keys():\n raise ValueError(\"Dupl... | [
"0.6392801",
"0.5942996",
"0.5747267",
"0.5710753",
"0.5690151",
"0.56838536",
"0.5620147",
"0.5595128",
"0.5472937",
"0.54096055",
"0.540147",
"0.5370474",
"0.5283803",
"0.5282305",
"0.5278821",
"0.518117",
"0.51735497",
"0.51548064",
"0.50842416",
"0.50651014",
"0.50636625"... | 0.78980774 | 0 |
Obtain device instance from 2fa setup wizard data. | def get_device_from_setup_data(self, request, setup_data):
return None # pragma: no cover | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_device():\n return context.get_context('device_target')",
"def get_device(self):\n self.connect_button = 1\n self.device_name = self.deviceEntry.text()",
"async def device_fixture(hass: HomeAssistant, ufp: MockUFPFixture):\n\n await init_entry(hass, ufp, [])\n\n device_registry ... | [
"0.63822013",
"0.62747025",
"0.6120741",
"0.60991645",
"0.6043958",
"0.60063523",
"0.5944667",
"0.5940644",
"0.5940644",
"0.5940644",
"0.5940644",
"0.5940644",
"0.5913711",
"0.58581173",
"0.5853114",
"0.5792714",
"0.57867616",
"0.57287025",
"0.56949663",
"0.5657453",
"0.56494... | 0.6423652 | 0 |
Return the authentication token form class. | def get_token_form_class(self):
from two_factor.forms import AuthenticationTokenForm
return AuthenticationTokenForm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_form(self, form_class=None):\n if form_class is None:\n form_class = self.get_form_class()\n return form_class(\n token=self.request.session.get('token', False),\n aiid=self.kwargs['aiid'],\n **self.get_form_kwargs()\n )",
"def get_form_cla... | [
"0.69181645",
"0.6369291",
"0.62895435",
"0.62263733",
"0.6211552",
"0.61699533",
"0.6150896",
"0.60946137",
"0.6051999",
"0.6045131",
"0.60052425",
"0.59485215",
"0.59444714",
"0.5924026",
"0.5838784",
"0.5834265",
"0.58061504",
"0.57755065",
"0.5772766",
"0.57478577",
"0.57... | 0.86554384 | 0 |
Test that math is outputting TeX code. | def test_math_extension_outputs_tex():
sample = r":math:`e^{ix} = \cos x + i\sin x`"
html = get_html_from_rst(sample)
assert_html_contains(
html,
"span",
attributes={"class": "math"},
text=r"\(e^{ix} = \cos x + i\sin x\)",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_simple(self):\r\n math = 'x^2'\r\n obj = preview.LatexRendered(math, tall=True)\r\n self.assertEquals(obj.latex, math)\r\n self.assertEquals(obj.sans_parens, math)\r\n self.assertEquals(obj.tall, True)",
"def test_power_simple(self):\r\n self.assertEquals(previe... | [
"0.7507089",
"0.71978104",
"0.7131753",
"0.6940951",
"0.69192207",
"0.6900085",
"0.6803327",
"0.6689187",
"0.66572785",
"0.66396725",
"0.65305763",
"0.64991444",
"0.6460122",
"0.6416397",
"0.64075565",
"0.637307",
"0.63704425",
"0.6288456",
"0.62506396",
"0.62028116",
"0.6167... | 0.7372334 | 1 |
Test SoundCloud iframe tag generation | def test_soundcloud_iframe():
sample = ".. soundcloud:: SID\n :height: 400\n :width: 600"
html = get_html_from_rst(sample)
assert_html_contains(
html,
"iframe",
attributes={
"src": (
"https://w.soundcloud.com/player/"
"?url=http://api.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_youtube_iframe():\n\n sample = \".. youtube:: YID\\n :height: 400\\n :width: 600\"\n html = get_html_from_rst(sample)\n assert_html_contains(\n html,\n \"iframe\",\n attributes={\n \"src\": (\n \"https://www.youtube-nocookie.com\"\n ... | [
"0.65098196",
"0.64758885",
"0.6079338",
"0.60508907",
"0.60338223",
"0.58340585",
"0.5785092",
"0.577833",
"0.5698256",
"0.56800616",
"0.56670403",
"0.56104773",
"0.5603128",
"0.5570797",
"0.5514298",
"0.5487627",
"0.5458812",
"0.5428872",
"0.54101866",
"0.5364591",
"0.53508... | 0.80010784 | 0 |
Test Youtube iframe tag generation | def test_youtube_iframe():
sample = ".. youtube:: YID\n :height: 400\n :width: 600"
html = get_html_from_rst(sample)
assert_html_contains(
html,
"iframe",
attributes={
"src": (
"https://www.youtube-nocookie.com"
"/embed/YID?rel=0&"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bb_youtube(hit):\n video = hit.group(1)\n return '<object width=\"425\" height=\"350\"><param name=\"movie\" value=\"http://www.youtube.com/v/%s\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.youtube.com/v/%s\" type=\"application/x-shockwave-flash\" wmode=\"transpar... | [
"0.68769556",
"0.6847462",
"0.66609895",
"0.6659137",
"0.65431464",
"0.6414613",
"0.63702035",
"0.6349991",
"0.6284504",
"0.62808007",
"0.6231663",
"0.61990386",
"0.6182694",
"0.6163565",
"0.6138838",
"0.61302125",
"0.6112555",
"0.61094904",
"0.6041209",
"0.6037975",
"0.60059... | 0.78585184 | 0 |
Test Youtube iframe tag generation with start_at attribute | def test_youtube_iframe_start_at():
sample = ".. youtube:: YID\n :height: 400\n :width: 600\n :start_at: 60"
html = get_html_from_rst(sample)
assert_html_contains(
html,
"iframe",
attributes={
"src": (
"https://www.youtube-nocookie.com"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_youtube_iframe():\n\n sample = \".. youtube:: YID\\n :height: 400\\n :width: 600\"\n html = get_html_from_rst(sample)\n assert_html_contains(\n html,\n \"iframe\",\n attributes={\n \"src\": (\n \"https://www.youtube-nocookie.com\"\n ... | [
"0.68381613",
"0.58002746",
"0.5656382",
"0.55563515",
"0.55528694",
"0.5551181",
"0.55401534",
"0.5517988",
"0.5499791",
"0.5476163",
"0.5425436",
"0.5424562",
"0.5404211",
"0.53970695",
"0.53929263",
"0.5322906",
"0.52933747",
"0.52933747",
"0.5274151",
"0.52623284",
"0.525... | 0.8507716 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.