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
create the reader list from a given set of file names and parameters
def getReadersFromFilenames(self): for i in self.readers: del i self.readers = [] if not self.filenames: raise Logging.GUIError("No files could be found", \ "For some reason, no files were listed to be imported.") files = self.filenames print "Determining readers from ", self.filename...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_file_readers():\n savefile_path = os.path.join(os.getcwd()+ \"/../data/\", SAVE_FILE)\n file_reader_list = []\n for file in os.listdir(savefile_path):\n file_reader = open(os.path.join(savefile_path,file), \"r\")\n file_reader_list.append({\"file_reader\": file_reader, \"last...
[ "0.6492544", "0.63382894", "0.6250799", "0.611366", "0.6069598", "0.6018633", "0.59182394", "0.5909983", "0.58632267", "0.58579755", "0.5853619", "0.5849561", "0.5829838", "0.580928", "0.57897955", "0.5785899", "0.57765526", "0.57752377", "0.57527864", "0.57526433", "0.574977...
0.679022
0
return the number of slices per timepoint
def getSlicesPerTimepoint(self): return self.slicesPerTimepoint
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataSetCount(self):\n\t\treturn int(self.numberOfImages / self.slicesPerTimepoint)", "def size(self):\n size = 1\n for current_slice in self.slices:\n size *= current_slice.stop - current_slice.start\n return size", "def n(self):\n return self._time_axis.size", "...
[ "0.7135924", "0.6884999", "0.64077276", "0.6373212", "0.6304518", "0.6302463", "0.6214839", "0.6137181", "0.6126625", "0.61182857", "0.6099939", "0.6055298", "0.6052316", "0.6023152", "0.59912443", "0.5985234", "0.59840417", "0.59639126", "0.59609234", "0.59437424", "0.594127...
0.76755035
0
Set the number of slices that belong to a given timepoint
def setSlicesPerTimepoint(self, n): assert n > 0, "Slices per timepoint needs to be greater than 0" print "Setting slices per timepoint to ", n self.slicesPerTimepoint = n self.z = n self.readers = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setNSlices(self,n):\n assert(n> 0)\n self._c_param.lee_richards_n_slices = n", "def setNumTimeSubSteps(*argv):", "def getSlicesPerTimepoint(self):\n\t\treturn self.slicesPerTimepoint", "def _set_window_time(slices, times):\n t_idx_ = [t[-1] for t in slices]\n return times[t_idx_]", ...
[ "0.6350953", "0.6137186", "0.58842385", "0.5869937", "0.56822366", "0.56016797", "0.5523093", "0.5513194", "0.54768455", "0.5377458", "0.5337342", "0.5313137", "0.5259041", "0.5251777", "0.52457607", "0.5220166", "0.5212587", "0.52124", "0.52096623", "0.5208932", "0.52069575"...
0.7975833
0
Returns the number of individual DataSets (=time points) managed by this DataSource
def getDataSetCount(self): return int(self.numberOfImages / self.slicesPerTimepoint)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count(self):\n return self.data_container.count", "def get_num_datasets(self, data):\n dsets = set()\n for items in data:\n dsetid = items[3]\n dsets.add(dsetid)\n return len(dsets)", "def count_data(self):\n try:\n ndata = len(self.x)\n ...
[ "0.7276192", "0.7221659", "0.72136873", "0.7015325", "0.69837743", "0.68426126", "0.6835689", "0.6830701", "0.6756762", "0.66132236", "0.6597357", "0.65931714", "0.65570873", "0.6531572", "0.6491252", "0.64376664", "0.6436097", "0.6429143", "0.642638", "0.6403021", "0.6397654...
0.79010725
0
Returns the spacing of the datasets this dataunit contains
def getSpacing(self): if not self.spacing: a, b, c = self.getVoxelSize() self.spacing = [1, b / a, c / a] return self.spacing
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetSpacing(self):\r\n\r\n return self._spacing", "def spacings(self):\n return np.array([self.pixel_spacing,\n self.pixel_spacing,\n self.slice_spacing])", "def spacing(self):\r\n\r\n return self.dx, self.dy, self.dz", "def margin(self)...
[ "0.69162726", "0.6651873", "0.66186863", "0.6618427", "0.6541836", "0.64272296", "0.6390034", "0.6284166", "0.6187805", "0.61713886", "0.6085297", "0.6026972", "0.6021646", "0.60199386", "0.5960843", "0.5940496", "0.59104943", "0.5868685", "0.573976", "0.5731771", "0.57220376...
0.7266339
0
Returns the voxel size of the datasets this dataunit contains
def getVoxelSize(self): return self.voxelsize
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voxel_size(self):\n return self.calculation.voxel_size", "def dataset_size(self):\n return self.dataset.size", "def GetVoxelSize(vDataSet):\r\n nx = vDataSet.GetSizeX()\r\n ny = vDataSet.GetSizeY()\r\n nz = vDataSet.GetSizeZ()\r\n\r\n if nx > 0: nx = abs(vDataSet.GetExtendMaxX()-v...
[ "0.8266003", "0.76687074", "0.7574417", "0.75476074", "0.7534628", "0.7282379", "0.72617334", "0.7169072", "0.7134597", "0.7131639", "0.71055424", "0.7064898", "0.70379966", "0.7025604", "0.7004166", "0.6994787", "0.69689655", "0.69596523", "0.6953735", "0.69417727", "0.69085...
0.7754449
1
set the voxel sizes of the images that are read
def setVoxelSize(self, vxs): self.voxelsize = vxs a, b, c = vxs self.spacing = [1, b / a, c / a]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _assign_sizes(self):", "def setinputsizes(self, sizes):\n pass", "def setImageDimensions(*args):", "def update_size(self):\n self.size = self.image.size\n self.width, self.height = self.size", "def set_size(self, size=None):\n if not size:\n size = self.output_siz...
[ "0.66988456", "0.6689091", "0.6536548", "0.61790437", "0.6176843", "0.61598647", "0.6149251", "0.6120889", "0.6050634", "0.6040322", "0.60017174", "0.59967524", "0.59520566", "0.5908052", "0.58848417", "0.5881362", "0.5838115", "0.5830686", "0.5829773", "0.57882386", "0.57879...
0.7176527
0
Returns number of images in this data source.
def getNumberOfImages(self): return self.numberOfImages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image_count(self):\n return self._num_images", "def get_num_of_images(self):", "def num_of_images(self):\n return len(self.data['image_infos'])", "def numberOfImages(self):\n return len(self.imageList)", "def __len__(self):\n return self.num_images", "def __len__(self)...
[ "0.84259796", "0.83975625", "0.83702207", "0.80581206", "0.77916324", "0.77916324", "0.77916324", "0.77916324", "0.77916324", "0.77843183", "0.7672272", "0.7612054", "0.74140126", "0.7412375", "0.72965276", "0.7274649", "0.7274649", "0.72326416", "0.72228235", "0.7218599", "0...
0.85196555
0
_jobSuccess_ A job has finished successfully. Non merge jobs are ignored. If it is complete success, all input files are marked as 'merged' and the output file as 'merged'. JobSuccess for partial merge are not implemented yet!. When it
def jobSuccess(self, jobReport): jobName = None try: #// Invoke job report handler with jobReport location and flag to enable/disable merge job report handling handler = ReportHandler(jobReport, int(self.args['MaxInputAccessFailures']), enableMergeHandling=self.enabled) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_job_success(self, job):\n super().handle_job_success(job)\n\n self._handle_job_status(job, \"finished\")", "def jobFailed(self, jobName):\n\n # ignore non merge jobs\n if jobName.find('mergejob') == -1:\n logging.info(\"Ignoring job %s, since it is not a merge jo...
[ "0.65560216", "0.6231087", "0.61976314", "0.61811936", "0.6096661", "0.60207766", "0.58854157", "0.5847686", "0.5811745", "0.5810917", "0.57712907", "0.572245", "0.5717534", "0.5705085", "0.5678648", "0.56590325", "0.5635989", "0.5614332", "0.5596668", "0.55745363", "0.556087...
0.67897856
0
_jobFailed_ A job has failed. Non merge jobs are ignored. Since it is a general failure, the error handler has tried to submit the job a number of times and it always failed. Mark then all input files as 'unmerged' (which will increment their failures counter) and the output file as 'failed'. If limit of failures in in...
def jobFailed(self, jobName): # ignore non merge jobs if jobName.find('mergejob') == -1: logging.info("Ignoring job %s, since it is not a merge job" \ % jobName) # Add cleanup flag for non merge jobs too logging.info("trigger cleanup for: %s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fail(self):\n self.cleanup()\n self.runner.report_job_fail(self.id)", "def handle_job_error(self, job):\n super().handle_job_error(job)\n\n self._handle_job_status(job, \"failed\")", "def runjob(job):\n inputfiles = glob.glob(job['InputFile'])\n logecho(' %s file/...
[ "0.64195037", "0.6388101", "0.6150792", "0.6027144", "0.60192287", "0.60131675", "0.5950463", "0.59497935", "0.5936166", "0.59313744", "0.5911836", "0.5835701", "0.5786333", "0.5782995", "0.5782858", "0.57241905", "0.57127255", "0.5671086", "0.56666774", "0.56585604", "0.5630...
0.7485483
0
_getVersionInfo_ return version information
def getVersionInfo(cls): return __version__ + "\n"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_info(self):\n return self._jadeRpc('get_version_info')", "def get_version_info() -> Tuple[Text, Text]:", "def version_info(self):\n\n return __version_info__", "def info(self):\n version_str = self.version\n return Utils.version_str2tuple(version_str)", "def vers...
[ "0.80382955", "0.7959786", "0.78665364", "0.772043", "0.76289654", "0.7546513", "0.7518231", "0.7508608", "0.74194604", "0.72860444", "0.72014874", "0.7074777", "0.7063996", "0.7035926", "0.7033924", "0.699559", "0.6988741", "0.69872457", "0.69825757", "0.69360656", "0.693177...
0.80043864
1
Optional arguments for firmware upgrade test
def set_fw_args(args): os.environ["TEST_FW_OPT_ARGS"] = args.firmware_opt_args
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_upgrade_with_auto_upgrade_latest_engine_enabled():", "def null_upgrade_step(setup_tool):\n pass", "def test_patch_hyperflex_server_firmware_version(self):\n pass", "def test_update_hyperflex_server_firmware_version(self):\n pass", "def check_arguments(self):\n ## only four ...
[ "0.6306604", "0.6163344", "0.583488", "0.5804764", "0.57716423", "0.57552814", "0.57459766", "0.5694769", "0.5651118", "0.5639809", "0.55904186", "0.557991", "0.55499375", "0.5547003", "0.5539552", "0.55363226", "0.5525847", "0.55074257", "0.5484567", "0.5458392", "0.5432542"...
0.6882471
0
Sets the marker to the index's current position
def mark(self): # type: () -> None self._marker = self._idx
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark_pos(self, position, marker):\n i, j = self.board[position]\n self.grid[i][j] = marker", "def __setitem__(self, index, value):\n self.position[index] = value", "def set_mark( self, mark, index ):\n\n try:\n int(self.__grid[index-1])\n\n if mark.lower() ...
[ "0.7185202", "0.66934663", "0.6468027", "0.64015055", "0.63248855", "0.6277485", "0.6270743", "0.6233759", "0.6233759", "0.6202351", "0.61644644", "0.6080283", "0.60600364", "0.6030192", "0.60263723", "0.602531", "0.6000895", "0.5999829", "0.59920174", "0.5950956", "0.5903941...
0.7850461
0
Merges the given Item with the last one currently in the given Container if both are whitespace items. Returns True if the items were merged.
def _merge_ws(self, item, container): # type: (Item, Container) -> bool: last = container.last_item() if not last: return False if not isinstance(item, Whitespace) or not isinstance(last, Whitespace): return False start = self._idx - (len(last.s) + len(item.s))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_be_merged(prev, cur):\n\n WHITESPACE = (' ', '\\t')\n if not cur.mergeable or not prev.mergeable:\n return False\n # offset is char offset, not byte, so length is the char length!\n elif cur.offset != (prev.offset + prev.length):\n r...
[ "0.5630323", "0.562426", "0.51364464", "0.5081948", "0.5043025", "0.48954043", "0.48792508", "0.4865082", "0.48528847", "0.48474756", "0.48178267", "0.48116726", "0.47968078", "0.4795999", "0.478459", "0.47503677", "0.47446725", "0.47313824", "0.47310415", "0.47016767", "0.46...
0.75566405
0
Attempts to parse the next item and returns it, along with its key if the item is valuelike.
def _parse_item(self): # type: () -> Optional[Tuple[Optional[Key], Item]] self.mark() saved_idx = self._save_idx() while True: c = self._current if c == "\n": # Found a newline; Return all whitespace found up to this point. self.inc() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getNextKey(self, item):\n return (2, item)", "def getitem(value, key):\n try:\n return value[key]\n except Exception:\n return \"\"", "def p_value_key(protItem):\n return protItem[-1]", "def p_value_key(protItem):\n return protItem[-1]", "def get_next(item: str, after:...
[ "0.6376964", "0.6067354", "0.5974745", "0.5974745", "0.59615964", "0.5913587", "0.5901849", "0.589939", "0.5882357", "0.5807142", "0.57675356", "0.5747622", "0.56723076", "0.5654322", "0.5633313", "0.56198114", "0.5533659", "0.5505485", "0.5488771", "0.54648966", "0.5464157",...
0.7419916
0
Returns (comment_ws, comment, trail) If there is no comment, comment_ws and comment will simply be empty.
def _parse_comment_trail(self): # type: () -> Tuple[str, str, str] if self.end(): return "", "", "" comment = "" comment_ws = "" self.mark() while True: c = self._current if c == "\n": break elif c == "#": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_from_comment(self, comment):\n comment = re.sub(r'\\s+', ' ', comment.strip().strip(\"/*\").strip())\n if len(comment) == 0:\n return set(), set()\n domain_terms, code_elements = self.extract_from_sentence(comment)\n return domain_terms, code_elements", "def get...
[ "0.5537778", "0.55255157", "0.55058956", "0.54286265", "0.53183115", "0.53128594", "0.5308172", "0.5303508", "0.53024226", "0.52887475", "0.52451444", "0.52160954", "0.5189738", "0.51862514", "0.51771724", "0.5174911", "0.5149944", "0.51467705", "0.51425964", "0.5140602", "0....
0.7539042
0
Parses a Key at the current position; WS before the key must be exhausted first at the callsite.
def _parse_key(self): # type: () -> Key if self._current in "\"'": return self._parse_quoted_key() else: return self._parse_bare_key()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_bare_key(self): # type: () -> Key\n self.mark()\n while self._current.is_bare_key_char() and self.inc():\n pass\n\n key = self.extract()\n\n return Key(key, sep=\"\")", "def _parse_quoted_key(self): # type: () -> Key\n quote_style = self._current\n ...
[ "0.63221157", "0.6206109", "0.6151237", "0.5712115", "0.5649564", "0.53943276", "0.53714085", "0.5363242", "0.5210409", "0.51909065", "0.5114601", "0.50023776", "0.4978723", "0.49580935", "0.49418062", "0.4941112", "0.49383867", "0.49335584", "0.4920512", "0.49124452", "0.490...
0.68402857
0
Parses a bare key.
def _parse_bare_key(self): # type: () -> Key self.mark() while self._current.is_bare_key_char() and self.inc(): pass key = self.extract() return Key(key, sep="")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_key(self): # type: () -> Key\n if self._current in \"\\\"'\":\n return self._parse_quoted_key()\n else:\n return self._parse_bare_key()", "def parse_key(raw_key):\n raw_key_bytes = raw_key.encode('ascii')\n try:\n validate_cmek(raw_key)\n key_type = KeyType...
[ "0.76626766", "0.6655824", "0.6617215", "0.6501489", "0.6450143", "0.6249241", "0.6145767", "0.5899227", "0.5899173", "0.5889372", "0.5886852", "0.58818334", "0.5807456", "0.58011734", "0.5785233", "0.5777432", "0.57585365", "0.57519037", "0.5722677", "0.5717174", "0.57077587...
0.810298
0
Peeks ahead nonintrusively by cloning then restoring the initial state of the parser. Returns the name of the table about to be parsed, as well as whether it is part of an AoT.
def _peek_table(self): # type: () -> Tuple[bool, str] # Save initial state idx = self._save_idx() marker = self._marker if self._current != "[": raise self.parse_error( InternalParserError, ("_peek_table() entered on non-bracket character") ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_aot(self, first, name_first): # type: (Item, str) -> Item\n payload = [first]\n self._aot_stack.append(name_first)\n while not self.end():\n is_aot_next, name_next = self._peek_table()\n if is_aot_next and name_next == name_first:\n _, table = s...
[ "0.5321881", "0.5258151", "0.5246666", "0.51772755", "0.5133962", "0.4889261", "0.47756714", "0.4769611", "0.4711629", "0.46457544", "0.45855626", "0.45844787", "0.45794702", "0.4570339", "0.4569376", "0.456038", "0.45316866", "0.45240548", "0.4521015", "0.45061612", "0.44987...
0.7672022
0
Clean a sender address by using a predefined map
def clean_sender(sender): if sender in _sender_map: return _sender_map[sender] return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_recipient(recipient):\n if recipient in _recipient_map:\n return _recipient_map[recipient]\n return ''", "def _cleanupAddress(self, address):\n clean = []\n \n # This is sort of a desultory effort but I'm not convinced \n # that these cleanups will actually resu...
[ "0.6415194", "0.63102794", "0.6073433", "0.5693001", "0.5599912", "0.5535422", "0.5509846", "0.5509394", "0.5472849", "0.5472058", "0.5465454", "0.5461169", "0.5429801", "0.54245687", "0.53459334", "0.53453904", "0.53189844", "0.52752376", "0.52727574", "0.52652967", "0.52621...
0.6980281
0
Clean a recipient address by using a predefined map
def clean_recipient(recipient): if recipient in _recipient_map: return _recipient_map[recipient] return ''
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cleanupAddress(self, address):\n clean = []\n \n # This is sort of a desultory effort but I'm not convinced \n # that these cleanups will actually result in cleaner searches\n for word in address.split(None):\n lower = word.lower()\n \n # Som...
[ "0.6710551", "0.6352095", "0.6117725", "0.6082749", "0.59901404", "0.5843147", "0.5725053", "0.56326616", "0.5629568", "0.56150633", "0.56043804", "0.5557785", "0.55360675", "0.5443463", "0.54358226", "0.5432276", "0.5409129", "0.5401632", "0.53814", "0.53644365", "0.5340619"...
0.7065244
0
Some dumps of hotmail messages introduce weird line breaks into header content, making them impossible to parse. This function will fix this content.
def fix_broken_hotmail_headers(text): end_of_header_match = _end_of_simple_header_pattern.search(text) temp_header_text = text[:end_of_header_match.end()].strip() lines = temp_header_text.splitlines()[1:] # first line is not a header... fixed_header_lines = reduce(_merge_broken_header_lines, lines, [])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_broken_yahoo_headers(text):\n end_of_header_match = _end_of_multipart_header_pattern.search(text)\n temp_header_text = text[:end_of_header_match.end()].strip()\n lines = temp_header_text.splitlines()\n fixed_header_lines = reduce(_merge_broken_header_lines, lines, [])\n return_text = os.line...
[ "0.6554932", "0.6418198", "0.64063436", "0.6094776", "0.60202503", "0.5935732", "0.58566016", "0.58263063", "0.57753146", "0.57245463", "0.56043744", "0.5570992", "0.55153716", "0.55127054", "0.5502749", "0.54770464", "0.5456795", "0.5437268", "0.53645223", "0.5352466", "0.53...
0.73432523
0
Some dumps of yahoo messages introduce weird line breaks into header content, making them impossible to parse. This function will fix this content.
def fix_broken_yahoo_headers(text): end_of_header_match = _end_of_multipart_header_pattern.search(text) temp_header_text = text[:end_of_header_match.end()].strip() lines = temp_header_text.splitlines() fixed_header_lines = reduce(_merge_broken_header_lines, lines, []) return_text = os.linesep.join(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_broken_hotmail_headers(text):\n end_of_header_match = _end_of_simple_header_pattern.search(text)\n temp_header_text = text[:end_of_header_match.end()].strip()\n lines = temp_header_text.splitlines()[1:] # first line is not a header...\n fixed_header_lines = reduce(_merge_broken_header_lines, l...
[ "0.64710176", "0.6009694", "0.5937977", "0.5803022", "0.57353634", "0.5620867", "0.5585157", "0.55775535", "0.55016285", "0.5496441", "0.54666466", "0.54155815", "0.53363466", "0.52728117", "0.52605987", "0.52031696", "0.5202499", "0.51547736", "0.5134256", "0.5130388", "0.51...
0.7440384
0
Returns a single message object from a list of text content and attachments in a MIME message, after filtering out unwanted content. Also handles nested content like forwarded messages.
def get_nested_payload(mime_message): return_message = EmailMessage() return_message.subject = mime_message.get('Subject') return_message.sender = clean_sender(mime_message.get('From')) return_message.recipient = clean_recipient(mime_message.get('To')) return_message.date = parse(mime_message.get('D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_content(content):\n attachments = []\n body = None\n html = None\n\n for part in content.walk():\n if part.get('Content-Disposition') is not None:\n decoded_data = decode_attachment(part)\n\n attachment = parse_attachment(part)\n if attachment:\n att...
[ "0.6099892", "0.6005864", "0.59787667", "0.59406656", "0.5869029", "0.5850756", "0.5808466", "0.57489055", "0.5714828", "0.5676952", "0.5646985", "0.5642732", "0.56374663", "0.56352216", "0.5632284", "0.56273305", "0.56104976", "0.5606248", "0.55780625", "0.55734146", "0.5572...
0.6649057
0
Coerce an unknown date to the given timezone, then to UTC
def normalize_to_utc(date, timezone): local_tz = pytz.timezone(timezone) new_date = date.replace(tzinfo = local_tz) utc_tz = pytz.timezone('UTC') new_date = new_date.astimezone(utc_tz) return new_date
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toutc(dateobj, timezone):\n fmtdate = parser.parse(dateobj) # string to datetime object\n user_tz = pytz.timezone(timezone) # getting user's timezone\n localize_date_with_tz = user_tz.localize(fmtdate) #adding user's timezone to datetime object\n utcdate = pytz.utc.normalize(localize_date_with_tz) ...
[ "0.75894195", "0.7289164", "0.7209024", "0.6907422", "0.6864215", "0.6698652", "0.6688846", "0.6686423", "0.6653843", "0.6593803", "0.6576157", "0.6573529", "0.6562767", "0.6553227", "0.65446633", "0.6526314", "0.64945215", "0.64906996", "0.6474339", "0.64524305", "0.6386153"...
0.76795125
0
Auslesen aller Konversationen aus der Datenbank
def find_all(self): result = [] cursor = self._cnx.cursor() command = "SELECT id, konversation, nachricht_id, teilnehmer, herkunfts_id, ziel_id, inhalt FROM konversationen" cursor.execute(command) tuples = cursor.fetchall() for (id, konversation, nachricht_id, teilneh...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_typing_block(self):\n\t # open the database using the masterpassword\n typing_text = 'Send({})\\n'.format(self.masterpassword)\n\n # add in exit - this is achieved using CTRL + q\n typing_text += 'Sleep(15677)\\n'\n typing_text += \"SendKeepActive('KeePass')\\n\"\n ty...
[ "0.57340914", "0.56032443", "0.5596878", "0.55474406", "0.5542437", "0.5542437", "0.5542437", "0.5542437", "0.5542437", "0.55125624", "0.55125624", "0.55125624", "0.5512051", "0.5425027", "0.54236233", "0.54012054", "0.5378505", "0.5372138", "0.5365111", "0.5340748", "0.53144...
0.6025704
0
Test hiding opponents' hands.
def test_privatize_hands(self): g = Game() g.add_player(uuid4(), 'p0') g.add_player(uuid4(), 'p1') gs = g p0, p1 = gs.players latrine, insula, jack, road = cm.get_cards(['Latrine', 'Insula', 'Jack', 'Road']) p0.hand.set_content([latrine, insula]) p1.hand...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_play_no_gain(self):\n self.card = self.g[\"Festival\"].remove()\n self.plr.piles[Piles.HAND].set(\"Duchy\")\n self.plr.add_card(self.card, Piles.HAND)\n self.plr.favors.set(2)\n self.plr.test_input = [\"No\"]\n self.plr.play_card(self.card)\n self.assertEqu...
[ "0.66469085", "0.66251075", "0.661568", "0.6462299", "0.63435477", "0.625224", "0.6242946", "0.62145275", "0.61973673", "0.6194856", "0.61828953", "0.6082449", "0.60560155", "0.6051513", "0.59985155", "0.5985109", "0.5983806", "0.5977845", "0.5970393", "0.5968302", "0.5965452...
0.69971275
0
Test with only threecard petitions allowed.
def test_only_three_card_petitions(self): f = gtrutils.check_petition_combos self.assertTrue( f( 0, 0, [0], False, True)) self.assertFalse( f( 1, 0, [0], False, True)) self.assertTrue( f( 1, 1, [0], False, True)) self.assertTrue( f( 1, 0, [3], False, True)) self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_two_and_three_card_petitions(self):\n f = gtrutils.check_petition_combos\n\n self.assertTrue( f( 0, 0, [], True, True))\n\n self.assertFalse( f( 1, 0, [], True, True))\n self.assertFalse( f( 1, 0, [1], True, True))\n self.assertTrue( f( 1, 0, [2], True, True))\n ...
[ "0.6810119", "0.6473808", "0.645677", "0.62938344", "0.62752783", "0.62059915", "0.6155211", "0.6148065", "0.60892385", "0.59840876", "0.596696", "0.5963209", "0.59501404", "0.5799793", "0.5697761", "0.5672481", "0.566434", "0.561755", "0.56103486", "0.5594359", "0.5582937", ...
0.7429536
0
Test with two and threecard petitions
def test_two_and_three_card_petitions(self): f = gtrutils.check_petition_combos self.assertTrue( f( 0, 0, [], True, True)) self.assertFalse( f( 1, 0, [], True, True)) self.assertFalse( f( 1, 0, [1], True, True)) self.assertTrue( f( 1, 0, [2], True, True)) self.assertT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_only_three_card_petitions(self):\n f = gtrutils.check_petition_combos\n\n self.assertTrue( f( 0, 0, [0], False, True))\n\n self.assertFalse( f( 1, 0, [0], False, True))\n self.assertTrue( f( 1, 1, [0], False, True))\n self.assertTrue( f( 1, 0, [3], False, True))\n ...
[ "0.7009317", "0.6996275", "0.65862507", "0.6539536", "0.65000474", "0.64990026", "0.64953685", "0.6476889", "0.64768463", "0.6467368", "0.6336645", "0.6292399", "0.6257715", "0.62031925", "0.61506057", "0.6122968", "0.60999656", "0.6068418", "0.6024874", "0.6014065", "0.60111...
0.7173055
0
Test limit at beginning of game.
def test_initial_limit(self): g = test_setup.simple_two_player() p1, p2 = g.players self.assertEqual(g._clientele_limit(p1), 2) self.assertEqual(g._clientele_limit(p2), 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _safe_limit_check(self):\n if self.rem == 40:\n self.time_start = time.time()\n elif time.time() - self.time_start >= 11:\n self.rem = 40\n self.time_start = time.time()\n elif self.rem <= 0:\n t = 11 - (time.time() - self.time_start)\n\n ...
[ "0.6717742", "0.65904355", "0.64534426", "0.64433163", "0.643638", "0.6354526", "0.6331702", "0.6220812", "0.6176772", "0.61617315", "0.6129828", "0.60590106", "0.6015792", "0.5951251", "0.5916098", "0.5896707", "0.58848923", "0.5870503", "0.5835869", "0.5821406", "0.58180004...
0.7055831
0
Test limit with completed Aqueduct.
def test_limit_with_aqueduct(self): d = TestDeck() g = test_setup.simple_two_player() p1, p2 = g.players self.assertEqual(g._clientele_limit(p1), 2) p1.buildings.append(Building(d.aqueduct, 'Concrete', complete=True)) self.assertEqual(g._clientele_limit(p1), 4) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_environmental_impact_compliance():\n emissions = 12000\n legal_limit = 300\n assert emissions < legal_limit", "def test_get_remain_limit(self):\n finder = FinderInsidePro(self.test_key)\n limit = finder.get_remain_limit()\n assert isinstance(limit, int)\n assert limi...
[ "0.6602689", "0.65843254", "0.65533227", "0.63588923", "0.63528883", "0.6254358", "0.6215978", "0.6180673", "0.61653847", "0.61470395", "0.6145852", "0.6117478", "0.61015135", "0.6094627", "0.6062201", "0.5976109", "0.59308255", "0.59041405", "0.5900028", "0.5873644", "0.5867...
0.7109697
0
record the modified tweet/tweeted structures on disk
def __update_local_tweets(self): f_tweets = open(f'{TWEETS}', 'w') f_tweeted = open(f'{TWEETED}', 'w') try: f_tweets.write(json.dumps(self.tweets, sort_keys=True, indent=4)) f_tweeted.write(json.dumps(self.tweeted, sort_keys=True, indent=4)) finally: f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, tid, tmsg, tent, fp_rel=REL_PATH):\n # TODO\n # work out if saved previously and give better response\n \n\n # save to file system/rest api? where?\n # save to filesystem\n # TODO what day is this? localtime?\n fn = dt.fn_current_day(ext='json')\n\n ...
[ "0.6658211", "0.6079574", "0.6022582", "0.5911571", "0.58289623", "0.57782304", "0.57550776", "0.57268596", "0.5723704", "0.5721074", "0.57111156", "0.56885713", "0.5671371", "0.5641506", "0.56221664", "0.5615904", "0.5552578", "0.5543077", "0.55106515", "0.55028576", "0.5494...
0.7087227
0
Route for getting tweets by hashtag.
def get_tweets_by_hashtag_route(hashtag): response, code = get_tweets_by_hashtag( hashtag, request.args.get('limit', 30)) return jsonify(response), code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getByHashtags(hashtag):\n\n # set page_limits. The default is 1 \n pages_limit = request.args.get('pages_limit') or 1\n pages_limit = int(pages_limit)\n\n raw_response = get_response(tw_api, 'search/tweets', { 'q': '#' + hashtag, 'count': 100 }, pages_limit)\n list_response = convert_resp2list(r...
[ "0.70752335", "0.66526765", "0.66291153", "0.66205215", "0.6536219", "0.6486589", "0.63549507", "0.6294649", "0.5997771", "0.5885162", "0.5859275", "0.56409836", "0.561119", "0.55870056", "0.5549043", "0.55390894", "0.5523961", "0.54777485", "0.54763746", "0.54185194", "0.538...
0.8222778
0
Route for getting tweets by a user.
def get_tweets_by_user_route(username): response, code = get_tweets_by_user( username, request.args.get('limit', 30)) return jsonify(response), code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_user_tweets(username):\n userdata = query_db('select * from user where username = ?',\n [username], one=True)\n if userdata is None:\n abort(404)\n else:\n user_details = {\"username\": userdata['username'],\"user_id\":userdata['user_id']}\n\n followed = False\n if requ...
[ "0.7213664", "0.684018", "0.6731007", "0.67143995", "0.6648292", "0.65042245", "0.63557523", "0.6336596", "0.62716496", "0.624116", "0.6206272", "0.61798954", "0.61040026", "0.6077563", "0.6045129", "0.6031549", "0.60101897", "0.6005784", "0.6003022", "0.5988208", "0.5985817"...
0.81342083
0
Create a formatted mail message to sent to worker user. This method pass the user and evaluation_link to be processed by txt template alerts/subscription_message.txt
def alert_subscription_message(request, user): message = loader.get_template( 'alerts/subscription_message.txt').render( {'user': user, 'evaluation_link': resolve_worker_evaluation_url(request, user)}) return message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_created_email(self):\n if settings.NOTIFY_NEW_REG:\n to = settings.NOTIFY_NEW_REG\n message = \"\"\"\\\nGreetings,<br><br>\n\nA new vehicle registration has been submitted by %s.<br><br>\n\nGo here to view or edit the request: <br>\n<a href=\"%s\">%s</a>\n<br><br>\nSincerely,<...
[ "0.6634772", "0.63277805", "0.6235654", "0.6227511", "0.61810446", "0.61754483", "0.6124126", "0.6124126", "0.6104047", "0.60752434", "0.6052107", "0.59274155", "0.5924757", "0.590727", "0.58884096", "0.5875973", "0.5858161", "0.58423764", "0.58318377", "0.58315945", "0.58279...
0.777387
0
Create a formatted email message to sent to worker user template alerts/new_service_notification.txt
def alert_new_service_notification(hirer, worker, service): domain = Site.objects.get_current().domain url = "http://" + domain + "/worker/" message = loader.get_template( 'alerts/new_service_notification.txt').render( {'worker': worker, 'hirer': hirer, 'service': service, 'url':url}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_created_email(self):\n if settings.NOTIFY_NEW_REG:\n to = settings.NOTIFY_NEW_REG\n message = \"\"\"\\\nGreetings,<br><br>\n\nA new vehicle registration has been submitted by %s.<br><br>\n\nGo here to view or edit the request: <br>\n<a href=\"%s\">%s</a>\n<br><br>\nSincerely,<...
[ "0.7332573", "0.7300195", "0.70396394", "0.65700346", "0.6381602", "0.63333446", "0.6274574", "0.62374425", "0.61783296", "0.61655205", "0.6151091", "0.61510384", "0.6135396", "0.6120886", "0.61056536", "0.60524446", "0.6039856", "0.6035018", "0.6004501", "0.5985513", "0.5972...
0.74509716
0
Create a formatted email message to sent to worker user template alerts/service_notification.txt
def alert_service_notification(user, service): message = loader.get_template( 'alerts/service_notification.txt').render( {'user': user, 'service': service}) return message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alert_new_service_notification(hirer, worker, service):\n\n domain = Site.objects.get_current().domain\n url = \"http://\" + domain + \"/worker/\"\n\n message = loader.get_template(\n 'alerts/new_service_notification.txt').render(\n {'worker': worker, 'hirer': hirer, 'service': service, ...
[ "0.7191147", "0.6990005", "0.69212645", "0.65836084", "0.64851093", "0.6402051", "0.6330503", "0.6326159", "0.62814146", "0.6238903", "0.62185687", "0.6207358", "0.6139531", "0.60843295", "0.60813093", "0.60735154", "0.6054305", "0.60353315", "0.6029179", "0.60170865", "0.598...
0.74859136
0
Create a formatted email message to the worker when a hirer makes an evaluation template alerts/worker_evaluated.txt
def alert_worker_evaluated(hirer,worker): message = loader.get_template( 'alerts/worker_evaluated.txt').render( {'worker': worker, 'hirer': hirer}) return message
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_created_email(self):\n if settings.NOTIFY_NEW_REG:\n to = settings.NOTIFY_NEW_REG\n message = \"\"\"\\\nGreetings,<br><br>\n\nA new vehicle registration has been submitted by %s.<br><br>\n\nGo here to view or edit the request: <br>\n<a href=\"%s\">%s</a>\n<br><br>\nSincerely,<...
[ "0.6600645", "0.6544189", "0.63650763", "0.63307947", "0.6069563", "0.60685426", "0.6014015", "0.5973316", "0.59537005", "0.5941229", "0.58852065", "0.5875624", "0.58755213", "0.58395034", "0.582515", "0.5794151", "0.57777476", "0.5777449", "0.5768729", "0.57670987", "0.57439...
0.79926217
0
Return the guessed language of POSTed text.
def POST(self, text): lang = guess_language(text) return {'language': lang}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_language(self, text):\n try:\n post_lang = detect(text)\n except:\n post_lang = 'N/A'\n return post_lang", "def guess_language(text): # pragma: no cover\n try:\n from guess_language import guessLanguage\n return Language.fromguessit(guessLangua...
[ "0.84711045", "0.7443068", "0.72882843", "0.7189894", "0.7099894", "0.7063926", "0.69427687", "0.67506385", "0.6746426", "0.6721064", "0.670669", "0.66078335", "0.6576339", "0.6564039", "0.65360004", "0.65185875", "0.6517528", "0.6502088", "0.64020914", "0.63992137", "0.63880...
0.7704462
1
Generates a sha1 checksum for a given string
def get_checksum(str): hash_object = hashlib.sha1(b'%s' % str) hex_dig = hash_object.hexdigest() return hex_dig
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sha1(s: str) -> str:\n return hashlib.sha1(s.encode()).hexdigest()", "def sha1(self, s):\n\t\tself.sha1_calls += 1\n\t\treturn int(hashlib.sha1(s).hexdigest(), 16)", "def SHA1(self) -> _n_0_t_3[_n_0_t_9]:", "def checksum_from_sha1(value):\n # More constrained regex at lexer level\n CHECKSUM_RE =...
[ "0.7719917", "0.75582397", "0.727031", "0.71468693", "0.7109886", "0.7050218", "0.704167", "0.7008932", "0.6944196", "0.6943862", "0.69164616", "0.6908371", "0.69008803", "0.6843064", "0.67979276", "0.67816305", "0.6755393", "0.67546755", "0.67312115", "0.6660172", "0.663221"...
0.79029137
0
Appends .svg to a checksum
def get_filename(checksum): return '%s.svg' % checksum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _append_svg(self, svg, before_prompt=False):\n self._append_custom(self._insert_svg, svg, before_prompt)", "def __merger_svg(self):\n pass", "def save_svg(xml_string, checksum=None):\n if checksum is None:\n checksum = get_checksum(xml_string) # Get checksum of this file\n e...
[ "0.6322185", "0.6220869", "0.6096771", "0.6001254", "0.58138853", "0.57505566", "0.5744236", "0.57401705", "0.56943905", "0.5545867", "0.5537553", "0.5533253", "0.5466105", "0.5450053", "0.5445687", "0.54211104", "0.5349227", "0.53329223", "0.532195", "0.5315566", "0.5292804"...
0.6853433
0
Uploads the SVG file to S3, and returns the URL of the object
def upload_svg(filename, xml_string): s3 = boto3.client('s3') response = s3.put_object( ACL='public-read', Body=xml_string, Bucket=BUCKET, Key=filename, StorageClass='REDUCED_REDUNDANCY', ) return 'https://s3.amazonaws.com/%s/%s' % (BUCKET, filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(file_path, aws_path, access_key, secret_key) -> None:\n # bucket = \"dev-com-courtlistener-storage\"\n bucket = \"seals.free.law\"\n client = boto3.client(\n \"s3\",\n aws_access_key_id=access_key,\n aws_secret_access_key=secret_key,\n )\n transfer = S3Transfer(client...
[ "0.65627086", "0.6511997", "0.64451045", "0.63643384", "0.61173415", "0.6040773", "0.6031718", "0.60039645", "0.5967601", "0.5940069", "0.5857561", "0.58238834", "0.5796205", "0.574195", "0.57342345", "0.57331437", "0.5722847", "0.57148886", "0.57147944", "0.5705097", "0.5654...
0.7696398
0
Saves an XML string as a unique (checksummed) file in S3 And returns the URL of the file Checks for duplicates along the way using sha1 to find collisions
def save_svg(xml_string, checksum=None): if checksum is None: checksum = get_checksum(xml_string) # Get checksum of this file existing_url = is_duplicate_checksum(checksum) # Make sure it's unique if existing_url is not None: # We've generated this file before. logger.info('Du...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_duplicate_checksum(checksum):\n s3 = boto3.client('s3')\n response = s3.list_objects_v2(\n Bucket=BUCKET,\n EncodingType='url',\n Prefix=checksum\n )\n\n if response['KeyCount'] > 0 and len(response['Contents']) > 0:\n return 'https://s3.amazonaws.com/%s/%s' % (BUCKET...
[ "0.6614705", "0.62321055", "0.5942641", "0.5849977", "0.5737562", "0.5682555", "0.567223", "0.5630804", "0.5596855", "0.5581484", "0.5557663", "0.547344", "0.5443973", "0.5370834", "0.5353757", "0.531475", "0.52927846", "0.52644974", "0.5246912", "0.52463406", "0.5242865", ...
0.6733674
0
Create the translations model for the shared model 'model'. 'related_name' is the related name for the reverse FK from the translations model. 'meta' is a (optional) dictionary of attributes for the translations model's inner Meta class. 'fields' is a dictionary of fields to put on the translations model.
def create_translations_model(model, related_name, meta, **fields): if not meta: meta = {} unique = [('language_code', 'master')] meta['unique_together'] = list(meta.get('unique_together', [])) + unique # Create inner Meta class Meta = type('Meta', (object,), meta) name = '%sTranslation...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_translations_model(shared_model, related_name, meta, **fields):\n if not meta:\n meta = {}\n\n if shared_model._meta.abstract:\n # This can't be done, because `master = ForeignKey(shared_model)` would fail.\n raise TypeError(\"Can't create TranslatedFieldsModel for abstract cl...
[ "0.7985823", "0.5591691", "0.49817428", "0.4975373", "0.4800113", "0.47464964", "0.4744232", "0.47395378", "0.47331527", "0.46989104", "0.46264884", "0.46264884", "0.459076", "0.45905438", "0.45603356", "0.4508293", "0.44997284", "0.44252264", "0.44179207", "0.4414165", "0.43...
0.822475
0
Contribute translations options to the inner Meta class and set the descriptors. This get's called from TranslateableModelBase.__new__
def contribute_translations(cls, rel): opts = cls._meta opts.translations_accessor = rel.get_accessor_name() opts.translations_model = rel.model opts.translations_cache = '%s_cache' % rel.get_accessor_name() trans_opts = opts.translations_model._meta # Set descri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_translations_model(model, related_name, meta, **fields):\n if not meta:\n meta = {}\n unique = [('language_code', 'master')]\n meta['unique_together'] = list(meta.get('unique_together', [])) + unique\n # Create inner Meta class \n Meta = type('Meta', (object,), meta)\n name = '%...
[ "0.6093402", "0.5498365", "0.5405703", "0.5377071", "0.5377071", "0.52954173", "0.5262987", "0.5173471", "0.5130741", "0.51139444", "0.5081222", "0.5053549", "0.50521266", "0.5046423", "0.50335914", "0.50004405", "0.4973911", "0.4968481", "0.49118015", "0.49080524", "0.486693...
0.73294145
0
When this instance is saved, also save the (cached) translation
def save_translations(cls, instance, **kwargs): opts = cls._meta if hasattr(instance, opts.translations_cache): trans = getattr(instance, opts.translations_cache) if not trans.master_id: trans.master = instance trans.save()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, *args, **kwargs):\n\n ret = super(Translation, self).save(*args, **kwargs)\n\n # Does cache invalidation\n cache_key = Translation.objects.make_cache_key(type(self), self.object_id, self.language)\n cache.set(cache_key, self)\n\n return ret", "def save(self, *arg...
[ "0.81048036", "0.6967799", "0.66896576", "0.64093536", "0.6083553", "0.60599184", "0.6016258", "0.59257364", "0.5915563", "0.59141093", "0.59141093", "0.59141093", "0.59141093", "0.59141093", "0.59109294", "0.589746", "0.5893489", "0.5889759", "0.58738244", "0.58508587", "0.5...
0.7327054
1
Add various entries to a cube dictionary and sort by socket index
def normalize(district, purpose, cube_dictionary_list): for gui_index, cube_dictionary in enumerate(cube_dictionary_list): cube_dictionary["district"] = district cube_dictionary["purpose"] = purpose cube_dictionary["gui_index"] = gui_index # Dictionary is given in a natural gui display orde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_vertex_to_clusters(clusters,vertex):\n for key in clusters:\n clusters[key].append(vertex)", "def make_neighbor_db(data):\n acted_with = {}\n for i, j, _ in data:\n # the setdefault method lets us avoid checking for ourselves whether an\n # actor is aclready in the dictionar...
[ "0.52169806", "0.5209674", "0.5192503", "0.5059949", "0.50562185", "0.50340647", "0.503215", "0.49723428", "0.4956823", "0.4896037", "0.48916155", "0.48439723", "0.48249584", "0.48159158", "0.48155957", "0.47965276", "0.4795622", "0.47880176", "0.47797826", "0.47521746", "0.4...
0.58312446
0
Performs the right division 'dst / src', and moves 'result_in' to 'dst' to either retrieve the division or the modulo
def perform_divide(c, dst, src, result_in8, result_in16): # We're likely going to need to save some temporary variables # No 'push' or 'pop' are used because 'ah /= 3', for instance, destroys 'al' # 'al' itself can be pushed to the stack, but a temporary variable can hold tmps = TmpVariables(c) # I...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_div_inplace(a, b):", "def true_div_inplace(a, b):", "def divup(a, b):\n return (a + b - 1) // b", "def divide(lhs, rhs):\n return _make.divide(lhs, rhs)", "def div(self, source, destination):\n value = bytearray()\n\n dividend = destination\n divider = source\n\n i...
[ "0.6179031", "0.6050849", "0.59951925", "0.5947101", "0.5941931", "0.5891567", "0.58224696", "0.5819864", "0.5762812", "0.57600236", "0.57048416", "0.5681911", "0.5675549", "0.5665095", "0.5660404", "0.5639097", "0.56374323", "0.5618714", "0.56052095", "0.55648005", "0.556480...
0.7103163
0
Visualise and record rangeDoppler matrices with projected points PARAMETERS
def visualise_points_on_rd(rd_matrix, path, points, range_res, doppler_res): rd_img = SignalVisualizer(rd_matrix).get_image for point in points: range_coord = (point[0] / range_res).astype(int) doppler_coord = (point[1] / doppler_res).astype(int) if point[1] < 0: doppler_coor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_pin_position_range():\n #Create a sample goniometer\n g = TopazInHouseGoniometer()\n\n #Initialize the leg limits\n g.relative_sample_position = column([0.0, 0.0, 0.0])\n g.getplatepos(0.0, 0.0, 0.0)\n g.calculate_leg_xy_limits(visualize=True)\n\n# if True:\n# pylab.show()\n#...
[ "0.59820175", "0.5681855", "0.5632588", "0.55993336", "0.5567278", "0.5558949", "0.55241627", "0.552349", "0.552066", "0.5517947", "0.5500038", "0.54207855", "0.5374178", "0.5372016", "0.5361266", "0.5345306", "0.534296", "0.5339282", "0.5336971", "0.5336114", "0.53311783", ...
0.6764529
0
Generate random RGB colors for a given seed
def get_random_rgb(seed): random.seed(seed) r = random.randint(0, 255) g = random.randint(0, 255) b = random.randint(0, 255) return [r, g, b]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_color_gen():\n r = randint(0, 255)\n g = randint(0, 255)\n b = randint(0, 255)\n return [r, g, b]", "def random_color():\n colormode(255)\n return randint(0, 255), randint(0, 255), randint(0, 255)", "def _genRandomColor():\n b = random.randint(0, 255)\n g = random.randint(0, ...
[ "0.814636", "0.7701456", "0.76977193", "0.74837154", "0.746802", "0.737749", "0.73708177", "0.7207782", "0.7160151", "0.7154133", "0.7105417", "0.70931727", "0.70826614", "0.7022558", "0.7013978", "0.69533306", "0.6892857", "0.68925637", "0.6831503", "0.6779909", "0.67476416"...
0.84251815
0
Method to compute the coefficients of the straight line between two points
def compute_line_coefs(point_a, point_b): b_coef = -1 if (point_b[0] - point_a[0]) == 0: a_coef = 0 else: a_coef = (point_b[1] - point_a[1]) / (point_b[0] - point_a[0]) c_coef = point_b[1] - a_coef*point_b[0] return np.array([a_coef, b_coef, c_coef])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_linear_coef(p1, p2):\n slope = (p1[1] - p2[1]) / (p1[0] - p2[0])\n intercept = p1[1] - slope * p1[0]\n return slope, intercept", "def generate_line(point_1, point_2):\r\n A = point_1.y - point_2.y\r\n B = point_2.x - point_1.x\r\n C = point_1.y * B + point_1.x * A\r\n ret...
[ "0.7252494", "0.7058825", "0.70182276", "0.69539297", "0.68374145", "0.6692208", "0.66759145", "0.66448915", "0.6642555", "0.6631278", "0.660639", "0.65882164", "0.6564653", "0.65506494", "0.64859647", "0.64820635", "0.643047", "0.6408767", "0.63719994", "0.6311349", "0.62959...
0.80344635
0
Method to compute the orthogonal projection of a point on a straight line Let's define (D) the straight line which coeff are given as parameters
def compute_orthogonal_proj(line_coefs, point_coordinates): a = line_coefs[0] c = line_coefs[2] # Compute c_prime by replacing with the coordinates of the point c_prime = a*point_coordinates[1] + point_coordinates[0] x_proj = (c_prime-a*c)/((a**2)+1) y_proj = (a*c_prime+c)/((a**2)+1) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projection_of_pt_on_line(point, line_point1, line_point2):\n projection = Point(-1, -1)\n projection.x = point.x\n if (line_point2.x - line_point1.x) != 0:\n projection.y = (projection.x - line_point1.x) * (line_point2.y - line_point1.y) / \\\n (line_point2.x - line_po...
[ "0.6800761", "0.64928424", "0.63452107", "0.6339828", "0.60856456", "0.6082376", "0.6082376", "0.59750146", "0.59033185", "0.5879611", "0.58655274", "0.5820088", "0.58171314", "0.5814186", "0.5794391", "0.5717215", "0.56910175", "0.56728375", "0.5667023", "0.5649503", "0.5608...
0.7622919
0
Checks to see if the destination exists If a source file is passed in, run a checksum
def checkfile(filename, source=None): if source: # Let's check some sums if os.path.exists(filename) and os.path.exists(source): src_sha = calchash(source) dest_sha = calchash(filename) if DRYRUN: print("{src} hash {src_sha}. {dest} hash {dest_sha}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checksum_compare(source_file, dest_file):\n\n con_ssh = ControllerClient.get_active_controller()\n\n LOG.info(\"Compare checksums on source file and destination file\")\n cmd = \"getfattr -m . -d {}\"\n\n exitcode, source_sha = con_ssh.exec_cmd(cmd.format(source_file))\n LOG.info(\"Raw source fi...
[ "0.7140068", "0.6845625", "0.6302969", "0.6295187", "0.61806387", "0.61280686", "0.60687417", "0.59943986", "0.59558606", "0.5897827", "0.5882352", "0.58686715", "0.5864275", "0.58456916", "0.58347523", "0.58037543", "0.57591784", "0.5748481", "0.57282805", "0.57282805", "0.5...
0.7357597
0
Escape value for commaseparated list
def list_escape(s): return re.sub(r'[\\,]', _escape_char, s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quote_list(the_list):\n return [\"'%s'\" % element for element in the_list]", "def _format_list_for_query(input_list):\n return (\n \", \".join(input_list).replace(\" \", \"\").replace(\"'\", \"\").replace(\",\", \"%2C\")\n )", "def escape_value(value: OptionValueType) -> Option...
[ "0.6734296", "0.64581853", "0.6446276", "0.64394754", "0.63908434", "0.6385253", "0.63293046", "0.632233", "0.61730325", "0.59699094", "0.59477973", "0.5917379", "0.5887457", "0.5872731", "0.58519614", "0.58464056", "0.5803603", "0.58012146", "0.579517", "0.57884943", "0.5786...
0.68377125
0
Extract list of tags from KeyUsage extension.
def extract_key_usage(self, ext): res = [] fields = KU_FIELDS[:] # "error-on-access", real funny if not ext.key_agreement: fields.remove('encipher_only') fields.remove('decipher_only') for k in fields: val = getattr(ext, k, False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_xkey_usage(self, ext):\n oidmap = {v: k for k, v in XKU_CODE_TO_OID.items()}\n res = []\n for oid in ext:\n if oid in oidmap:\n res.append(oidmap[oid])\n else:\n raise InvalidCertificate(\"Unsupported ExtendedKeyUsage oid: %s\" % ...
[ "0.6921014", "0.6244223", "0.60213065", "0.594296", "0.59360904", "0.59154725", "0.59044653", "0.5891674", "0.5891674", "0.58631593", "0.5841936", "0.57997465", "0.5775625", "0.5767615", "0.57545197", "0.5743227", "0.5717393", "0.5711848", "0.5693686", "0.5669996", "0.5638222...
0.6967917
0
Create Name object from subject's DistinguishedName.
def get_name(self): return self.load_name(self.subject)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(subdomain, subject_type_or_type_name, subject_name, author):\n return Subject(key_name='%s:%s' % (subdomain, subject_name),\n type=get_name(subject_type_or_type_name), author=author)", "def create_subject(name=\"Basket Weaving\"):\n subj = Subject(name=name)\n subj.s...
[ "0.6042233", "0.57407993", "0.5645988", "0.56094193", "0.55473876", "0.53495145", "0.521684", "0.51685303", "0.51498526", "0.5132291", "0.5014182", "0.49951622", "0.49933416", "0.4948473", "0.4948473", "0.48978388", "0.4867619", "0.48654392", "0.48593077", "0.48541546", "0.48...
0.57814914
1
Converts list of prefixed strings to GeneralName list.
def load_gnames(self, gname_list): gnames = [] for alt in gname_list: if ':' not in alt: raise InvalidCertificate("Invalid gname: %s" % (alt,)) t, val = alt.split(':', 1) t = t.lower().strip() val = val.strip() if t == 'dn': ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_to_names(names):\n names_list = []\n for n in names:\n names_list.append(names[n].details['name'])\n return names_list", "def original_names(names):\n if len(names) > 0 and isinstance(names[0], (list, tuple)):\n names = [x[0] for x in names]\n\n return [re.sub('_+$', '', x) ...
[ "0.65021443", "0.6432721", "0.61846787", "0.6088756", "0.6081885", "0.6031575", "0.6005844", "0.59734565", "0.5912184", "0.58610666", "0.5832652", "0.5829637", "0.58152074", "0.574755", "0.5740378", "0.5698568", "0.5694689", "0.56923187", "0.5686958", "0.56855613", "0.56847",...
0.6499037
1
Return ocsp_urls as GeneralNames
def get_ocsp_gnames(self): urls = ['uri:' + u for u in self.ocsp_urls] return self.load_gnames(urls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_issuer_urls_gnames(self):\n urls = ['uri:' + u for u in self.issuer_urls]\n return self.load_gnames(urls)", "def urls(self) -> list[str]:\r\n ...", "def getURLs():", "def list_urls(self, prefix: str = \"\", etl_name: str = None) -> Iterable[str]:", "def get_crl_gnames(self):\n ...
[ "0.6319815", "0.6266063", "0.6263989", "0.62039906", "0.60305554", "0.5934846", "0.5844959", "0.583849", "0.58368385", "0.56617916", "0.5622121", "0.5613717", "0.55928856", "0.5585941", "0.55812305", "0.5537399", "0.5493335", "0.5492435", "0.5488834", "0.54792345", "0.5478065...
0.72922915
0
Return issuer_urls as GeneralNames
def get_issuer_urls_gnames(self): urls = ['uri:' + u for u in self.issuer_urls] return self.load_gnames(urls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject_alt_uris(self):\n\n return self._get_subject_alt('uniform_resource_identifier')", "def subject_alt_domains(self):\n\n return self._get_subject_alt('dns_name')", "def get_crl_gnames(self):\n urls = ['uri:' + u for u in self.crl_urls]\n return self.load_gnames(urls)", "d...
[ "0.61785847", "0.59527624", "0.5829397", "0.5827037", "0.5789031", "0.57227594", "0.5698465", "0.5667429", "0.56406856", "0.55386025", "0.5526594", "0.55237424", "0.54851675", "0.5471927", "0.54601336", "0.54285586", "0.5422123", "0.5397905", "0.53853244", "0.53811383", "0.53...
0.83089095
0
Return crl_urls as GeneralNames
def get_crl_gnames(self): urls = ['uri:' + u for u in self.crl_urls] return self.load_gnames(urls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_issuer_urls_gnames(self):\n urls = ['uri:' + u for u in self.issuer_urls]\n return self.load_gnames(urls)", "def urls(self) -> list[str]:\r\n ...", "def list_urls(self, prefix: str = \"\", etl_name: str = None) -> Iterable[str]:", "def getURLs():", "def AuthorURLs(entry):\n ...
[ "0.6717781", "0.6483335", "0.6474641", "0.637163", "0.6109357", "0.59807044", "0.5915114", "0.5866936", "0.57854867", "0.575787", "0.57498235", "0.57257307", "0.56991327", "0.5698962", "0.5662451", "0.5650308", "0.55682266", "0.5550901", "0.55472463", "0.5547159", "0.55458784...
0.69459665
0
Return TLS Feature list
def get_tls_features(self): tls_features = [] if self.ocsp_must_staple: tls_features.append(x509.TLSFeatureType.status_request) if self.ocsp_must_staple_v2: tls_features.append(x509.TLSFeatureType.status_request_v2) return tls_features
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _runtime_feature_list(self):\n supported_features_command = [self._path_to_driver(), '--print-supported-features']\n try:\n output = self._executive.run_command(supported_features_command, error_handler=Executive.ignore_error)\n except OSError, e:\n _log.warn(\"Except...
[ "0.6554773", "0.6229621", "0.6155694", "0.6152324", "0.6034768", "0.59933424", "0.5971594", "0.5917329", "0.5915376", "0.5915376", "0.5915376", "0.5915376", "0.5885361", "0.5870308", "0.58026606", "0.57677984", "0.5735279", "0.5718903", "0.57177716", "0.5692858", "0.56664056"...
0.77832854
0
Add common extensions to Cert or CSR builder.
def install_extensions(self, builder): # BasicConstraints, critical if self.ca: ext = x509.BasicConstraints(ca=True, path_length=self.path_length) else: ext = x509.BasicConstraints(ca=False, path_length=None) builder = builder.add_extension(ext, critical=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_extensions(self, ext_stack):\n return m2.x509_req_add_extensions(self.req, ext_stack._ptr())", "def build_extension(self, ext):\n build_all()\n super(cffiBuilder, self).build_extension(ext)", "def build_extensions(self):\n c = self.compiler.compiler_type\n CF = [] ; L...
[ "0.68608624", "0.6400358", "0.63571113", "0.63295335", "0.63138413", "0.6188864", "0.6090052", "0.6024872", "0.59441936", "0.5844638", "0.5754354", "0.5681884", "0.56702286", "0.5670175", "0.56068116", "0.5569463", "0.5534916", "0.5526108", "0.54374963", "0.54269266", "0.5408...
0.7651184
0
New Elliptic Curve key
def new_ec_key(name='secp256r1'): if name not in EC_CURVES: raise ValueError('Unknown curve') return ec.generate_private_key(curve=EC_CURVES[name], backend=get_backend())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_ecc_private_key(curve_name: str = 'P-256') -> EllipticCurvePrivateKeyWithSerialization:\n curve_obj = {\n 'P-256': ec.SECP256R1(),\n 'P-384': ec.SECP384R1(),\n 'P-521': ec.SECP521R1()\n }[curve_name]\n return ec.generate_private_key(curve_obj, default_backend()) # type: ...
[ "0.7240443", "0.702215", "0.69358593", "0.69095886", "0.6824323", "0.644343", "0.6409015", "0.63836247", "0.6371176", "0.63416773", "0.6324077", "0.62912446", "0.6263568", "0.62155515", "0.6212738", "0.6199788", "0.6176039", "0.6160097", "0.6147054", "0.6129228", "0.61161697"...
0.78493464
0
Serialize certificate in PEM format.
def cert_to_pem(cert): return cert.public_bytes(Encoding.PEM)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_certificate(self, cert):\n return cert.public_bytes(\n serialization.Encoding.PEM,\n ).decode(encoding='UTF-8')", "def pem_armor_certificate(certificate):\n\n return asymmetric.dump_certificate(certificate)", "def serialize_certificate(\n certificate: Certificate, enco...
[ "0.7233042", "0.68470275", "0.68383855", "0.6716175", "0.6495609", "0.6100652", "0.60305905", "0.60305905", "0.60305905", "0.60291034", "0.6010482", "0.59719867", "0.59408164", "0.59336966", "0.59336966", "0.5918769", "0.59016013", "0.5878901", "0.58332604", "0.5830136", "0.5...
0.7239738
0
Serialize certificate request in PEM format.
def req_to_pem(req): return req.public_bytes(Encoding.PEM)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cert_to_pem(cert):\n return cert.public_bytes(Encoding.PEM)", "def _build_pem(tls_cert):\n pem = ()\n if tls_cert.intermediates:\n for c in tls_cert.intermediates:\n pem = pem + (c,)\n if tls_cert.certificate:\n pem = pem + (tls_cert.certificate,)\n if tls_cert.private...
[ "0.6295511", "0.6238403", "0.6178628", "0.6023338", "0.596094", "0.5930526", "0.5825464", "0.5816554", "0.57833594", "0.57833594", "0.5726823", "0.571607", "0.56658447", "0.5638736", "0.56148493", "0.55883175", "0.5558911", "0.54970115", "0.54970115", "0.54914117", "0.5478445...
0.7018637
0
Read password from potentially gpgencrypted file.
def load_password(fn): if not fn: return None data = load_gpg_file(fn) data = data.strip(b'\n') return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_key():\n return open(\"pass.key\", \"rb\").read()", "def _PasswordFromFile(self, hostname, port, username):\n\n\t\tif username == None or len(username) == 0:\n\t\t\treturn None\n\n\t\tif hostname == None or hostname == UNIX_DOMAIN_PATH:\n\t\t\thostname = DefaultHost\n\n\t\tpgpassfile = self._getPoolP...
[ "0.6575987", "0.6558546", "0.64441496", "0.6166849", "0.60289574", "0.600363", "0.5950623", "0.59272367", "0.59127575", "0.5835766", "0.5814732", "0.57961124", "0.5790752", "0.5773013", "0.5772841", "0.5765816", "0.57390904", "0.5737546", "0.5721898", "0.56895983", "0.5678449...
0.807333
0
Parse commaseparated list to strings.
def parse_list(slist): res = [] for v in loop_escaped(slist, ','): v = v.strip() if v: res.append(v) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, output):\n q = '['\n prepro = [line for line in output if \"['''', ''''],\" not in line]\n prepro = [line for line in prepro if \"[',', ','],\" not in line]\n for line in prepro:\n process = line.strip()\n process = process.replace('[', '(')\n ...
[ "0.6197948", "0.6151549", "0.6102005", "0.606939", "0.60056645", "0.596137", "0.5894534", "0.58915085", "0.58653396", "0.58636934", "0.58515674", "0.5836412", "0.58261746", "0.5818068", "0.5795482", "0.5790831", "0.5783101", "0.5743863", "0.5742642", "0.5727883", "0.5720543",...
0.68961257
0
Collect commandline arguments into CertInfo.
def info_from_args(args): return CertInfo( subject=parse_dn(args.subject), usage=parse_list(args.usage), alt_names=parse_list(args.san), ocsp_nocheck=args.ocsp_nocheck, ocsp_must_staple=args.ocsp_must_staple, ocsp_must_staple_v2=args.ocsp_must_staple_v2, ocsp_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_arguments(self):\n cert_location = f\"dependencies{sep}certificates{sep}localuser.crt\"\n key_location = f\"dependencies{sep}certificates{sep}localuser.key\"\n assert Path(cert_location).exists(), (\n f\"The certificate isn't \"\n f\"present at location {Path(cer...
[ "0.650702", "0.6123743", "0.60399014", "0.60012686", "0.59843737", "0.57966566", "0.5721231", "0.5682582", "0.5598154", "0.5594984", "0.5591436", "0.5585888", "0.55673426", "0.55233204", "0.5516206", "0.5511681", "0.55067706", "0.54973185", "0.54691166", "0.545013", "0.544308...
0.6634239
0
Load commandline arguments, create Certificate Signing Request (CSR).
def req_command(args): if args.files: die("Unexpected positional arguments") subject_info = info_from_args(args) if subject_info.ca: msg('Request for CA cert') else: msg('Request for end-entity cert') subject_info.show(msg_show) # Load private key, create signing reque...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_command(args):\n if args.files:\n die(\"Unexpected positional arguments\")\n\n # Load certificate request\n if not args.request:\n die(\"Need --request\")\n subject_csr = load_req(args.request)\n\n reset_info = None\n if args.reset:\n reset_info = info_from_args(args...
[ "0.7071083", "0.6448927", "0.64444983", "0.63485956", "0.6237446", "0.6178711", "0.61732894", "0.6083192", "0.6013771", "0.59875655", "0.5984441", "0.5983292", "0.5934362", "0.5875236", "0.58677095", "0.58173174", "0.58064055", "0.5790398", "0.5781913", "0.5750335", "0.574030...
0.6887356
1
resets precision and recall
def reset(self) -> None: self.precision.reset() self.recall.reset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_precision(self, precision) :\n self.__precision = self.parent().action().filter(precision)", "def change_precision(self, precision):\n if precision <= 0:\n print(\"Precision must be positive\")\n else:\n self.precision = precision\n self.input_equati...
[ "0.6554539", "0.6496719", "0.64400053", "0.63610476", "0.6251985", "0.6230156", "0.61648434", "0.61604416", "0.6144796", "0.6111396", "0.6090455", "0.6075918", "0.60632086", "0.6062955", "0.60555625", "0.6028188", "0.6028188", "0.59946746", "0.5988276", "0.5975022", "0.597060...
0.81031436
0
Bounds all real values into [lower, upper] using a provided method
def set_bounds( self: A, lower: BoundValue = None, upper: BoundValue = None, method: str = "clipping", full_range_sampling: bool = False, a_min: BoundValue = None, a_max: BoundValue = None, ) -> A: # TODO improve description of methods lower, upper = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simplebounds(cls, val, lower, upper):\n if val < lower:\n val = lower\n if val > upper:\n val = upper\n return val", "def _bound(x, min_value, max_value):\n return np.maximum(min_value, np.minimum(x, max_value))", "def apply_bound(x, var_min, var_max):\n ...
[ "0.71283054", "0.68890387", "0.65130097", "0.6450955", "0.6424436", "0.63653696", "0.63593006", "0.6322421", "0.62083405", "0.62054557", "0.6173497", "0.60966706", "0.60829145", "0.607084", "0.607084", "0.6065957", "0.59931934", "0.59931576", "0.5980716", "0.5976944", "0.5952...
0.71421045
0
Converts array with appropriate shapes to reduced (uncentered) space by applying log scaling and sigma scaling
def _to_reduced_space(self, value: np.ndarray) -> np.ndarray: sigma = self.sigma.value if self.bound_transform is not None: value = self.bound_transform.backward(value) distribval = value if self.exponent is None else np.log(value) / np.log(self.exponent) reduced = distribval...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rescale_data(self):\n\n # Dividing every array of simulated data vectors by the mean of that array.\n '''# Didnt work\n for key in self.data.keys():\n self.data[key] /= np.mean(self.data[key])\n '''\n\n self.rescaled = True\n\n # Mean normalization\n ...
[ "0.6439206", "0.6292463", "0.6131833", "0.60969806", "0.60392785", "0.5985598", "0.59760886", "0.59423095", "0.58070093", "0.58033174", "0.5675887", "0.5661247", "0.5655357", "0.5631111", "0.5602358", "0.5597288", "0.5594214", "0.55887544", "0.5582954", "0.55819786", "0.55760...
0.6378868
1
This button method is used to Change Tenancy state to close.
def landlord_button_close(self): return self.write({'state': 'close'})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onBtnCloseClicked(self):\n self.close()", "def close_UI(self):", "def _cancel(self, __button):\r\n\r\n self.assistant.destroy()", "def _cancel(self, __button):\r\n\r\n self.assistant.destroy()", "def close(self, state):\n pass", "def close(event):\n event.widget.destroy...
[ "0.7391783", "0.68851864", "0.68595886", "0.68595886", "0.6839893", "0.68002075", "0.6791322", "0.6786216", "0.67538434", "0.67446655", "0.67278045", "0.67195815", "0.66731733", "0.6658879", "0.665314", "0.665314", "0.6634717", "0.6634717", "0.6610405", "0.66013527", "0.65797...
0.76498365
0
Create invoice for Rent Schedule.
def create_landlord_invoice(self): if self.tenancy_id.is_landlord_rent: account_jrnl_obj = self.env['account.journal'].search( [('type', '=', 'purchase')], limit=1) inv_lines_values = { # 'origin': 'tenancy.rent.schedule', 'name': 'Rent Cos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_invoice(self):\n self.ensure_one()\n partner = self.member_id.partner_id\n invoice = self.env['account.invoice'].create({\n 'partner_id': partner.id,\n 'account_id': partner.property_account_receivable_id.id,\n 'fiscal_position_id': partner.property...
[ "0.69727474", "0.64852816", "0.6456974", "0.64502263", "0.6428501", "0.64010954", "0.63116646", "0.6295384", "0.6290846", "0.6239638", "0.6185124", "0.61704993", "0.6166009", "0.6165586", "0.6118279", "0.6118134", "0.5988207", "0.5985031", "0.594222", "0.5859622", "0.5817861"...
0.7042408
0
Handy function which splits a list of arguments and keyword arguments, translates names of Gadget instances to actual objects, evaluates expressions that can be evaluated, and accepts the rest as strings. For example,
def str_to_args(line): args_in = line.split() args_out = [] kwargs_out = {} gadget_lookup = {g.name: g for g in Gadget.getinstances()} for a in args_in: if '=' in a: key, val = a.split('=') if ('*' in val) or ('?' in val): matching_names = filter(gadge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval(*args, **kwargs):\n\n pass", "def eval(x, env):\n if isinstance(x, Symbol): # variable reference\n return env.find(x)[x]\n elif not isinstance(x, List): # constant literal\n return x\n keyword = x.pop()\n if keyword in {\"quote\", \"'\"}: # (quote exp)\n return (\n...
[ "0.5543349", "0.5514955", "0.54775155", "0.54402816", "0.5358683", "0.52867675", "0.5281894", "0.52406925", "0.52398866", "0.51826596", "0.51759326", "0.51671344", "0.51667196", "0.5136077", "0.51311547", "0.5085241", "0.5079983", "0.5065142", "0.49714673", "0.4969139", "0.49...
0.6068337
0
if mouse is outside the window, the paddle will be at the edge.
def paddle_reset_position(self, mouse): if (0 + self.paddle.width / 2) <= mouse.x <= (self.window.width - self.paddle.width / 2): self.paddle_x = mouse.x - self.paddle.width / 2 self.window.add(self.paddle, self.paddle_x, self.paddle_y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paddle_moving(self, mouse):\n # when the paddle is in the window\n if 0 + self.paddle.width/2 <= mouse.x <= self.window.width - self.paddle.width/2:\n self.paddle.x = mouse.x - self.paddle.width / 2\n\n # when the paddle is about to leave the left side of the window\n eli...
[ "0.8009978", "0.70204043", "0.70202464", "0.693563", "0.66550136", "0.6435849", "0.6397138", "0.6362361", "0.63407254", "0.63133556", "0.6291798", "0.6267906", "0.6251655", "0.6229885", "0.61976296", "0.6141946", "0.6129163", "0.6072724", "0.6051235", "0.6037957", "0.59937733...
0.78187925
1
Generate a document containing the available variable types.
def generate_type_hierarchy(ctx): ctx.run("./env/bin/python -m puresnmp.types > doc/typetree.rst")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document_types(db: Session = Depends(get_db)):\n return get_document_types(db)", "def _variable_types(self):\n return self._variable_single_types + self._variable_array_types", "def doc_types(self):\n return self._extract_set('doc_type')", "def genotype(self):\n\t\tgenotype = \"\"\n\t\tf...
[ "0.61465466", "0.60761213", "0.5973325", "0.5913389", "0.5776444", "0.5673241", "0.56731915", "0.56657207", "0.56385726", "0.5612472", "0.55503535", "0.5506323", "0.5504591", "0.5486256", "0.5480814", "0.5403671", "0.54033583", "0.54031324", "0.5394926", "0.53930014", "0.5330...
0.6633607
0
Create needed indices in Elasticsearch.
def create_indices(self) -> None: self.client.indices.create( index="business", body=BUSINESS_MAPPINGS ) self.client.indices.create( index="review", body=REVIEW_MAPPINGS ) self.client.indices.create( index="tip", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_indices():\n destroy_indices()\n\n ActionDocument._index.create(ignore=[400, 404])\n ClassificationDocument._index.create(ignore=[400, 404])\n FunctionDocument._index.create(ignore=[400, 404])\n PhaseDocument._index.create(ignore=[400, 404])\n RecordDocument._index.create(ignore=[400, ...
[ "0.7837676", "0.73570573", "0.735629", "0.7337516", "0.7260696", "0.72410965", "0.7223582", "0.7056203", "0.67365074", "0.6722053", "0.6716243", "0.6706365", "0.666678", "0.66666", "0.6647666", "0.6642432", "0.66221064", "0.6614326", "0.6584603", "0.656978", "0.649845", "0....
0.8065617
0
Computes the x coordinate of the ball
def getBallX(state): region = state[93:189, 8:WIDTH-8, 0] nonzero_x_coords = region.nonzero()[1] if len(nonzero_x_coords) > 0: return nonzero_x_coords.mean() return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_x(self):\n return self.position.x", "def get_x(self):\n\t\treturn self._collision_rect.x + 14", "def x(self):\r\n return self.position.x", "def get_x(self):\n return self.posX", "def get_pos_x(self):\n return self.__pos_x", "def Getxcoord(self):\n return self.x_coo...
[ "0.7201727", "0.7096933", "0.69620883", "0.69616777", "0.68398833", "0.6825444", "0.68012977", "0.68012977", "0.67890507", "0.67753965", "0.67356485", "0.6712596", "0.67017496", "0.6700496", "0.6699452", "0.6689949", "0.66789895", "0.6650196", "0.6637467", "0.6616907", "0.661...
0.7251717
0
Computes the x coordinate of the paddle.
def getPaddleX(state): region = state[190:191, 8:WIDTH-8, 0] nonzero_x_coords = region.nonzero()[1] assert len(nonzero_x_coords) > 0 return nonzero_x_coords.mean()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_x(self):\n return self.position.x", "def get_x(self):\n return self.posX", "def x(self):\r\n return self.position.x", "def get_pos_x(self):\n return self.__pos_x", "def get_x_position(self):\n return self.rect.x", "def get_alien_x(self):\n return self.x", ...
[ "0.7278048", "0.71396947", "0.70126045", "0.6951281", "0.69439006", "0.6811559", "0.6754752", "0.6747178", "0.674097", "0.6727758", "0.6699524", "0.6672045", "0.6648935", "0.66291857", "0.6610564", "0.6605478", "0.65597486", "0.65584433", "0.6536112", "0.6401617", "0.6386279"...
0.7158066
1
Maps state to an action. Move the paddle to be under the ball.
def getAction(self, state): ball_x = getBallX(state) paddle_x = getPaddleX(state) if ball_x == -1: # if ball not seen, move paddle to middle target_x = (WIDTH - 16)/2 else: target_x = ball_x if target_x < paddle_x: action = LEFT ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _move_our_paddle(self, action) -> None:\n if not isinstance(action, int):\n action = action.item() # pops the item if the action is a single tensor\n assert action in [a for a in self.action_meanings.keys()], f\"{action} is not a valid action\"\n if action == self.actions['UP']...
[ "0.7522475", "0.6744767", "0.6475455", "0.63246346", "0.6307841", "0.63031274", "0.6293542", "0.6239462", "0.6162285", "0.6160075", "0.6146712", "0.6122981", "0.60952175", "0.6076362", "0.60531354", "0.60355747", "0.6020236", "0.5992324", "0.5984819", "0.5976522", "0.59671056...
0.6945269
1
Deprecated. Alias for `get_credentials()`.
def get_appengine_credentials(): return get_credentials()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_credentials(self):\n return self.credentials", "def GetUserCredentials():\n email = options.email\n if email is None:\n email = GetEmail(\"Email (login for uploading to %s)\" % options.server)\n password = getpass.getpass(\"Password for %s: \" % email)\n return (email, password)",...
[ "0.6579635", "0.6387039", "0.63844115", "0.63098377", "0.6289624", "0.6281468", "0.62561184", "0.62231666", "0.61097383", "0.60903406", "0.60723895", "0.60612416", "0.60548604", "0.60009325", "0.5988076", "0.5980738", "0.5970519", "0.59341145", "0.59061664", "0.5883298", "0.5...
0.67769206
0
Decode a token from a service account.
def decode_token_service_key(credentials, token, verify=True): return _decode_token(credentials, token, verify)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_token(token):\n decoded_token = jwt.decode(token, secret_key, algorithms=['HS256'])\n return decoded_token", "def decode_token(token, options=JWT_OPTIONS):\n return jwt.decode(\n token,\n SECRET_KEY,\n issuer=JWT_ISSUER,\n audience=JWT_AUDIENCE,\n options=op...
[ "0.7157648", "0.7092701", "0.70881104", "0.6925482", "0.6889764", "0.6852807", "0.6839684", "0.673713", "0.6725172", "0.6700684", "0.6668323", "0.6648689", "0.65112424", "0.6478294", "0.6444482", "0.6437185", "0.6422741", "0.64142865", "0.63824797", "0.63795084", "0.63528466"...
0.74529535
0
_masked_edge mask the edges of the swath gap
def _masked_edge(var,xac): if np.any(xac>0): ind_gap = (xac==np.nanmin(xac[xac>0])) if ind_gap.size==var.size: if ind_gap.shape!=var.shape: ind_gap = ind_gap.transpose() var[ind_gap] = np.nan elif ind_gap.size==var.shape[1]: var[:,ind_gap]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subgraph_mask(self, size):\n init_matrix = np.random.randn(size,size)\n Tcs = csgraph.minimum_spanning_tree(init_matrix)\n mask_matrix = Tcs.toarray()\n return mask_matrix", "def mask(self):", "def mask(self):\n mask = np.zeros((self.height, self.width))\n pts = [\...
[ "0.6540822", "0.6309648", "0.6181867", "0.59951514", "0.5955324", "0.5927942", "0.5888009", "0.5813421", "0.57741016", "0.5771686", "0.57375604", "0.57116854", "0.57070524", "0.570407", "0.57027954", "0.5653326", "0.56071967", "0.5605403", "0.55971795", "0.5577067", "0.556996...
0.7204979
0
Given a node that can be a real value or a sentinel value, visits the node if it is real with `visitor`. If the node is removed, returns MaybeSentinel.
def visit_sentinel( parent: "CSTNode", fieldname: str, node: Union[CSTNodeT, MaybeSentinel], visitor: "CSTVisitorT", ) -> Union[CSTNodeT, MaybeSentinel]: if isinstance(node, MaybeSentinel): visitor.on_visit_attribute(parent, fieldname) visitor.on_leave_attribute(parent, fieldname) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_optional(\n parent: \"CSTNode\", fieldname: str, node: Optional[CSTNodeT], visitor: \"CSTVisitorT\"\n) -> Optional[CSTNodeT]:\n if node is None:\n visitor.on_visit_attribute(parent, fieldname)\n visitor.on_leave_attribute(parent, fieldname)\n return None\n visitor.on_visit_a...
[ "0.59443796", "0.56053245", "0.5583689", "0.54266834", "0.52108747", "0.5164809", "0.5164809", "0.5084462", "0.50170124", "0.49877784", "0.49669993", "0.49597752", "0.48452675", "0.48225835", "0.47906753", "0.47757596", "0.47500685", "0.47187987", "0.47036573", "0.46635467", ...
0.63893396
0
Given an iterable of children, visits each child with `visitor`, and yields the new children with any `RemovalSentinel` values removed.
def visit_iterable( parent: "CSTNode", fieldname: str, children: Iterable[CSTNodeT], visitor: "CSTVisitorT", ) -> Iterable[CSTNodeT]: visitor.on_visit_attribute(parent, fieldname) for child in children: new_child = child.visit(visitor) if isinstance(new_child, FlattenSentinel): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_body_iterable(\n parent: \"CSTNode\",\n fieldname: str,\n children: Sequence[CSTNodeT],\n visitor: \"CSTVisitorT\",\n) -> Iterable[CSTNodeT]:\n\n visitor.on_visit_attribute(parent, fieldname)\n for child in children:\n new_child = child.visit(visitor)\n\n # Don't yield a c...
[ "0.742417", "0.596061", "0.59555763", "0.5783024", "0.5576109", "0.5383288", "0.5338851", "0.5332447", "0.5312418", "0.5300283", "0.52990466", "0.52795494", "0.5277477", "0.5260708", "0.5232784", "0.5212718", "0.5207777", "0.52073103", "0.5153014", "0.5149678", "0.5128579", ...
0.71860904
1
A convenience wrapper for `visit_body_iterable` that returns a sequence instead of an iterable.
def visit_body_sequence( parent: "CSTNode", fieldname: str, children: Sequence[CSTNodeT], visitor: "CSTVisitorT", ) -> Sequence[CSTNodeT]: return tuple(visit_body_iterable(parent, fieldname, children, visitor))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concrete(seq):\n if isinstance(seq, Iterator):\n seq = list(seq)\n if isinstance(seq, (tuple, list)):\n seq = list(map(concrete, seq))\n return seq", "def make_iterable(arg):\n return arg if is_iterable(arg) else (arg,)", "def toiter(x):\n if iterable(x):\n return x\n ...
[ "0.628293", "0.5938098", "0.59329444", "0.5872919", "0.5857194", "0.5846575", "0.5786622", "0.578137", "0.5776865", "0.5740671", "0.5727584", "0.57273525", "0.5643586", "0.5643586", "0.56330574", "0.55489177", "0.55487835", "0.5492281", "0.5490387", "0.5448653", "0.5433615", ...
0.60773885
1
make generic 2d drawer
def makeDrawer(self,node): drawer = MeshDrawer2D() drawer.setBudget(3000) drawerNode = drawer.getRoot() drawerNode.reparentTo(node) drawerNode.setDepthWrite(False) drawerNode.setTransparency(True) drawerNode.setTwoSided(True) drawerNode.setBin("fixed",0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw():", "def draw_walker(indx):\n chart_1.create_oval(hips[indx]-6, hips[indx+1]-6,hips[indx]+6, hips[indx+1]+6, fill= \"magenta\", width = 1, tag = 'line_1') \n chart_1.create_line(hips[indx], hips[indx+1], knee_a[indx], knee_a[indx+1], fill= \"blue\", width = 2, tag = 'line_1') \n chart_1.create...
[ "0.5789169", "0.57169425", "0.5665617", "0.5664664", "0.56565046", "0.5645116", "0.5549842", "0.5513326", "0.54959905", "0.54648364", "0.5380513", "0.5378376", "0.53420097", "0.52914715", "0.52714217", "0.5257676", "0.5251487", "0.52281845", "0.52245355", "0.5197554", "0.5197...
0.68525183
0
make the theme drawer
def makeThemeDrawer(self,node): themeDrawer = self.makeDrawer(node) themeDrawer.getRoot().setTexture(self.image) return themeDrawer
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(themes):\n # Get toggled mode based on current system mode.\n toggled_mode = get_toggled_mode(get_current_mode())\n print('\\nSetting themes...')\n\n for theme in themes:\n # Set toggled mode.\n theme.mode = toggled_mode\n theme.toggle_callback(theme)\n if IS_WINDOWS:\n...
[ "0.5896766", "0.56492335", "0.5608493", "0.5590127", "0.55801094", "0.54546154", "0.54343575", "0.5407063", "0.540511", "0.5388838", "0.5362931", "0.5360915", "0.53588575", "0.5346011", "0.5341834", "0.5332074", "0.5331664", "0.53218496", "0.52839094", "0.52213657", "0.519646...
0.75262403
0
draws all of the children
def draw(self,children): self.clip = [(0,0,gui._width+100, gui._height+100)] self.drawer.setClip(0,0,gui._width+100, gui._height+100) self.drawer.begin() z = 0 for child in reversed(children): z += 1 self.drawChild(0,0,z,child) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, force=False):\n for child in self.children.values():\n child.draw(force)", "def draw(self):\n for obj in self.objects:\n obj.draw()", "def draw(self):\n for tree_idx, tree in enumerate(self.trees):\n print(\"==================================...
[ "0.8111126", "0.7670635", "0.7543276", "0.7344588", "0.72956795", "0.7167588", "0.70602024", "0.70129067", "0.70129067", "0.70129067", "0.70129067", "0.70129067", "0.70129067", "0.70129067", "0.70129067", "0.69427055", "0.6871382", "0.68627614", "0.6847094", "0.67624927", "0....
0.82077765
0
draws the text and selection and caret
def drawEditText(self, font, text, x, y, selection=(0,0), caret=-1): self.color = Vec4(*font.color) name = font.name char_count = 0 ox = x baseLetter = self.atlas.getChar(name + str(ord("T"))) omaxh = baseLetter[3] - baseLetter[4][1] for line in text.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n if self.dirty:\n self._render()\n for text in self.text_lines:\n text.draw()", "def draw(self, win):\n self.rect.draw(win)\n self.text.draw(win)", "def text_draw(self, x, y, text, style={}):", "def draw(self, screen):\n lines = self.t...
[ "0.7433061", "0.7251996", "0.72452176", "0.7009771", "0.69782376", "0.6925863", "0.6890717", "0.6733484", "0.66595197", "0.6654603", "0.6588631", "0.65804046", "0.65804046", "0.65804046", "0.65804046", "0.6565332", "0.65605956", "0.6522511", "0.650832", "0.64866877", "0.64705...
0.72526735
1
Shows the guild's icon.
async def guild_icon( event, choice: (GUILD_ICON_CHOICES, 'Which icon of the guild?' ) = 'icon', ): guild = event.guild if (guild is None) or guild.partial: return Embed('Error', 'The command unavailable in guilds, where the application\'s bot is not in.') if choice == 'icon': n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def icon(self, ctx: lifesaver.Context):\n if not ctx.guild.icon:\n await ctx.send(\"This server doesn't have a custom icon.\")\n return\n\n await ctx.send(ctx.guild.icon.replace(format=\"png\"))", "def icon(self) -> str:\n return ICON_SERVER", "def icon(self):\n...
[ "0.79320234", "0.7129427", "0.6738884", "0.6581648", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6479007", "0.6479007", "0.63814235", "0.6271272", "0.62624985", "0.62624985", "0.62624985"...
0.754903
1
Converts the given Discord snowflake to time.
async def id_to_datetime_( snowflake: ('int', 'Id please!'), ): time = id_to_datetime(snowflake) return f'{time:{DATETIME_FORMAT_CODE}}\n{elapsed_time(time)} ago'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch2time(time):\n\tvalue = datetime.datetime.fromtimestamp(time)\n\tNormal = value.strftime('%Y-%m-%d %H:%M:%S')\n\tprint(normal)\n\treturn normal", "def conv_time(stamp):\n value = datetime.fromtimestamp(stamp)\n return value.strftime('%Y-%m-%d %H:%M:%S')", "def get_time(text_time):\n # return ...
[ "0.5873298", "0.58109105", "0.58083147", "0.5758464", "0.56725055", "0.5670564", "0.5648157", "0.5589003", "0.5543408", "0.5492668", "0.53174144", "0.53155077", "0.5314277", "0.52799726", "0.5264059", "0.5256253", "0.5210616", "0.5203832", "0.5203313", "0.51997644", "0.519302...
0.6189894
0
Shows the guild's features.
async def guild_features(event): guild = event.guild return Embed( f'{guild.name}\'s features', ', '.join(sorted(feature.name for feature in guild.iter_features())), ).add_thumbnail( guild.icon_url )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def features():\n\n return render_template('features.html')", "def print_features(self):\n print(feature_print_string.format(self.client_id,\n *tuple(map(lambda x: str(int(x)).zfill(4), self.features))))", "def display_features():\n\n # Parse the URL, check...
[ "0.7203288", "0.66593146", "0.6396423", "0.62870073", "0.620836", "0.60858047", "0.6041121", "0.6025823", "0.59256774", "0.59256774", "0.59256774", "0.59229654", "0.58711076", "0.580933", "0.57830375", "0.5771818", "0.5696934", "0.56376654", "0.56083906", "0.5593481", "0.5589...
0.81271005
0
Checks whether the user is banned.
async def is_banned(client, event, user: ('user', 'Who should I check?') ): if not event.user_permissions.can_ban_users: abort('You need to have `ban users` permissions to do this.') if not event.channel.cached_permissions_for(client).can_ban_users: abort('I need to have `ban users` per...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def bot_check(self, ctx):\n blocked = await self.db.fetchrow(\n \"\"\"\n SELECT *\n FROM blocks\n WHERE user_id=$1\n \"\"\",\n ctx.author.id,\n )\n if blocked is None:\n return True\n raise BlackListed", ...
[ "0.7057368", "0.66175896", "0.6572682", "0.65161735", "0.65136915", "0.64439887", "0.6424201", "0.6409703", "0.6405958", "0.6392394", "0.6381361", "0.636146", "0.63393056", "0.62737966", "0.6236421", "0.61819464", "0.6176241", "0.61632884", "0.61577547", "0.6119847", "0.60957...
0.6633141
1
Enables the ping command in your guild.
async def enable_ping( client, event, allow: ('bool', 'Enable?') = True, ): guild = event.guild if guild is None: abort('Guild only command.') if not event.user_permissions.can_administrator: abort('You must have administrator permission to invoke this command.') ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def ping_command(self, ctx):\n ping = int(self.client.latency * 1000)\n embed = Embed(\n title=\"Pong!\", description=f\"My ping is {ping}ms.\", color=Color.green()\n )\n await ctx.send(embed=embed)", "async def ping(self, ctx):\r\n embed = discord.Embed(\r\n ...
[ "0.66952026", "0.6496358", "0.64724076", "0.64568186", "0.6376278", "0.6348216", "0.6326083", "0.6313369", "0.62750304", "0.62690145", "0.6257727", "0.6251653", "0.62509406", "0.62384945", "0.6231913", "0.62314135", "0.62132555", "0.61965", "0.61832154", "0.61657685", "0.6158...
0.7750108
0
Returns the selected thread channel's name's length.
async def thread_channel_name_length( channel: ('channel_group_thread', 'Select a thread channel.') ): return len(channel.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def text_channel_name_length(\n channel: Channel\n):\n return len(channel.name)", "async def voice_channel_name_length(\n channel: P('channel', 'Select a voice channel', channel_types = [ChannelType.guild_voice])\n):\n return len(channel.name)", "def channel_size(self):\n if self.chann...
[ "0.79556036", "0.7465818", "0.67134553", "0.6301943", "0.62970394", "0.6221772", "0.61826706", "0.6180919", "0.61410934", "0.6127651", "0.61114144", "0.60849816", "0.6030827", "0.6022877", "0.6015919", "0.60124755", "0.5999161", "0.59950984", "0.5956299", "0.59463084", "0.594...
0.89964545
0
Returns the selected voice channel's name's length.
async def voice_channel_name_length( channel: P('channel', 'Select a voice channel', channel_types = [ChannelType.guild_voice]) ): return len(channel.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def text_channel_name_length(\n channel: Channel\n):\n return len(channel.name)", "async def thread_channel_name_length(\n channel: ('channel_group_thread', 'Select a thread channel.')\n):\n return len(channel.name)", "def namelength(self):\n return self[\"namelength\"]", "def __len_...
[ "0.7998428", "0.72766817", "0.67870444", "0.6776061", "0.6695213", "0.6688253", "0.6598871", "0.65934974", "0.64694244", "0.63770723", "0.6338646", "0.63136065", "0.6306306", "0.63023925", "0.6284565", "0.62841916", "0.62841916", "0.6279189", "0.6251116", "0.62204427", "0.620...
0.88903457
0
Returns the name of the touhou character by it's popularity position.
async def character_popularity( position: P('number', 'Please select a number between 1 and 20', min_value = 1, max_value = 20) ): return MOST_POPULAR_TOUHOU_CHARACTERS[position - 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _name_champion(self):\n # TODO BREAK TIES\n return max(self.teams, key=lambda team: len(team.wins))", "def get_name():\n\n return character['Name']", "def name_at_position(self, i: int) -> str:\n return self.names[i]", "def pname(name):\n ranks = list(reversed(name.split(';')))...
[ "0.615823", "0.61189646", "0.60745996", "0.57972014", "0.5788074", "0.5758207", "0.57052803", "0.5668703", "0.55920833", "0.55471593", "0.55327225", "0.55151343", "0.5483696", "0.547799", "0.54644465", "0.5454449", "0.542765", "0.5390605", "0.53518206", "0.532722", "0.5312515...
0.7177974
0
Edit's the selected user's nick.
async def set_nick( client, event, user: ('user', 'Who\'s?'), nick: P(str, 'Their new nick', min_length = 1, max_length = 32) = None, ): yield await client.user_guild_profile_edit(event.guild, user, nick=nick) yield f'{user:f}\'s nick has been updated'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def nick(\n self, context: Context, user: discord.User, *, nickname: str = None\n ) -> None:\n member = context.guild.get_member(user.id) or await context.guild.fetch_member(\n user.id\n )\n try:\n await member.edit(nick=nickname)\n embed = disc...
[ "0.776619", "0.77194846", "0.7687911", "0.7260133", "0.7148028", "0.70996314", "0.7096527", "0.70569235", "0.7005244", "0.7001775", "0.69678086", "0.6683608", "0.6653393", "0.6652248", "0.6580551", "0.64776564", "0.63855416", "0.6336465", "0.6322602", "0.6313675", "0.62873036...
0.78686786
0