query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
If the password is correct, displays lstatistic page. Otherwise, displays appropriate error message.
def login(self, password): if (password == "loveluay"): self.lStatisticStackedWidget.setCurrentIndex(1) else: moreInfo = "\"" + password + "\" is incorrect. please try again or contact chilleo@gmail.com" self.message("Incorrect Password", "The password you entered is ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate():\n return \"Please log in... Log in page\"", "def evaluate_password_health(users, print_password=False):\n hasUpperCase = \"[A-Z]\"\n hasLowerCase = \"[a-z]\"\n hasNumbers = \"\\d\"\n hasNonalphas = \"\\W\"\n results = []\n for username, password in users.items():\n ...
[ "0.5747581", "0.5714671", "0.56969535", "0.5679485", "0.5674646", "0.56705225", "0.5624725", "0.5614046", "0.56011856", "0.55548626", "0.5546437", "0.5505691", "0.54869825", "0.54830533", "0.54677933", "0.5462135", "0.54592884", "0.5451447", "0.5445026", "0.5444386", "0.54097...
0.66152185
0
Allows user to use enter/return key to submit password on password page.
def keyPressEvent(self, e): super(PhyloVisApp, self).keyPressEvent(e) if e.key() in [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return]: if (self.stackedWidget.currentIndex() == 5): if (self.lStatisticStackedWidget.currentIndex() == 0): self.login(self.lStatPasswo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enter_password(self):", "def enter_password(self):\n self.password.clear()\n self.password.click()\n self.password.send_keys(TestData.PASSWORD)\n sleep(TestData.DELAY)\n return self.password", "def ChangePassword():\n if self.ChangePassword():\n ...
[ "0.7701184", "0.7270404", "0.65003645", "0.642928", "0.6395058", "0.63937986", "0.6267385", "0.6249939", "0.62455666", "0.6233503", "0.61884034", "0.61816454", "0.61720026", "0.61567837", "0.61168325", "0.608349", "0.60649306", "0.6063698", "0.6044538", "0.6042732", "0.603957...
0.57734126
38
returns true if all tests pass otherwise false
def raxmlInputErrorHandling(self): try: # input alignment for raxml self.raxmlOperations.inputFilename = self.checkEntryPopulated(self.inputFileEntry, errorTitle='Missing Alignment', errorMessage='Please select an alignment.') self.raxmlOperations.windowSize = self.checkEntry...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_all_tests():\n successes = 0\n testsrun = 0\n testsdir = tests_dirpath()\n for test in os.listdir(testsdir):\n path = os.path.join(testsdir, test)\n if os.path.isdir(path):\n testsrun += 1\n if run_test(path):\n successes += 1\n print(\"--- ...
[ "0.7418144", "0.7351616", "0.7259784", "0.7037549", "0.703326", "0.68182933", "0.6786439", "0.6739737", "0.6676236", "0.6638024", "0.6632423", "0.6610456", "0.66022855", "0.6591967", "0.6577456", "0.6565592", "0.6536287", "0.6530585", "0.64995426", "0.6455215", "0.64511365", ...
0.0
-1
creates and displays and window displaying the message
def message(self, title, description, extraInfo, type='Err'): # create object errMessage = QtGui.QMessageBox() # set text errMessage.setText(title) errMessage.setInformativeText(description) errMessage.setDetailedText(extraInfo) # default pixmap for error ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_message(window, msg):\n v = create_output_panel(window, '')\n _append(v, msg)", "def display_message():", "def showMessage(self):", "def modeMsgBox(self, messageText):\n self.createMessage(messageText)", "def createMessageFrame (self,message):\n \n label = Tk.Label(self.f...
[ "0.7777422", "0.73143095", "0.7175642", "0.6992637", "0.6992474", "0.69156057", "0.68353176", "0.6790964", "0.678096", "0.6774758", "0.6747331", "0.6733183", "0.6716109", "0.67137617", "0.6659027", "0.66531986", "0.664738", "0.66387904", "0.66269374", "0.66074616", "0.6600948...
0.0
-1
creates and displays and window displaying the message
def question(self, title, description, type='Question'): # create object qMessage = QtGui.QMessageBox() # set text qMessage.setText(title) qMessage.setInformativeText(description) # default pixmap for error pixmap = QtGui.QPixmap('imgs/warning.png') # se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_message(window, msg):\n v = create_output_panel(window, '')\n _append(v, msg)", "def display_message():", "def showMessage(self):", "def modeMsgBox(self, messageText):\n self.createMessage(messageText)", "def createMessageFrame (self,message):\n \n label = Tk.Label(self.f...
[ "0.7777422", "0.73143095", "0.7175642", "0.6992637", "0.6992474", "0.69156057", "0.68353176", "0.6790964", "0.678096", "0.6774758", "0.6747331", "0.6733183", "0.6716109", "0.67137617", "0.6659027", "0.66531986", "0.664738", "0.66387904", "0.66269374", "0.66074616", "0.6600948...
0.0
-1
checks if given entry is empty or not. (i) if entry is populated returns text (ii) otherwise raises value error
def checkEntryPopulated(self, entry, errorTitle='Field Not Populated', errorMessage='Please populate field.', errorDescription=None): # if user does not provide an error description generate one automatically if not errorDescription: errorDescription = 'relevant entry name: ' + str(entry.ob...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _entry_field_values_are_not_empty(entry: _LexiconEntry) -> None:\n empty_fields = [f for f in _REQUIRED_FIELDS if not entry[f]]\n\n if empty_fields:\n field_str = \", \".join(sorted(empty_fields))\n raise InvalidLexiconEntryError(\n f\"Entry fields have empty values: '{field_str}'\")", "def ge...
[ "0.6981402", "0.6756794", "0.6678831", "0.66734993", "0.6366761", "0.6356786", "0.63151586", "0.631306", "0.62579745", "0.6219134", "0.6212304", "0.6151103", "0.61417395", "0.61398095", "0.6114239", "0.6044269", "0.60362357", "0.6025646", "0.602314", "0.60065186", "0.59784955...
0.7203207
0
checks if value of given entry is in range. i. if entry is in given range return it ii. otherwise raises value error
def checkEntryInRange(self, entry, min=(-1.0 * float('inf')), max=float('inf'), inclusive=True, errorTitle='Entry Out Of Range', errorMessage='', errorDescription=None): # if user does not provide an error description generate one automatically if not errorDescription: errorDescription = 'r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_range(num):\n for i in ranges.keys():\n if num in ranges[i]:\n return i", "def isInRange(self,section,option,testval):\n \"\"\" us to test if 15 is in range defined as e.g. \"1-10,12,16-19\" \"\"\"\n value=ConfigParser.SafeConfigParser.get(self,section,option)\n ...
[ "0.7152191", "0.7056733", "0.6937104", "0.6925974", "0.686642", "0.6862959", "0.6817519", "0.66738325", "0.66446173", "0.66358376", "0.6624139", "0.66183287", "0.65863585", "0.65854746", "0.65593094", "0.6500753", "0.6478799", "0.6467218", "0.644324", "0.64166504", "0.6406122...
0.7250366
0
returns the number of checkboxes that are checked
def getNumberChecked(self): return (self.checkboxScatterPlot.checkState() + self.checkboxDonutPlot.checkState() + self.checkboxAllTrees.checkState()) / 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_of_choices(self) -> int:\n return len(self._choices)", "def GetCheckBoxSize(*args, **kwargs):\n return _gdi_.RendererNative_GetCheckBoxSize(*args, **kwargs)", "def get_count_of_controls(self, recurse: bool) -> int:\n return len(list(self.get_all_controls(recurse)))", "def cou...
[ "0.63210493", "0.6222181", "0.6178917", "0.61608493", "0.61397576", "0.6122742", "0.6122495", "0.6058574", "0.6047955", "0.59916806", "0.59904414", "0.59828997", "0.594535", "0.59252757", "0.59179276", "0.59048724", "0.59024745", "0.5901195", "0.5893027", "0.5889103", "0.5889...
0.726542
0
toggles whether or not guiElement is enabled
def toggleEnabled(self, guiElement): enabled = guiElement.isEnabled() guiElement.setEnabled(not enabled)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _enable_disable_gui(self, state):\r\n self.mainWidget.standbyPushButton.setDisabled(state)\r\n self.mainWidget.eventComboBox.setDisabled(state)\r\n self.mainWidget.roomComboBox.setDisabled(state)\r\n self.mainWidget.dateComboBox.setDisabled(state)\r\n self.mainWidget.talkComb...
[ "0.69816", "0.69582343", "0.6883505", "0.68738556", "0.68276453", "0.6776707", "0.67430043", "0.67430043", "0.6729134", "0.6666026", "0.6665531", "0.6665531", "0.662512", "0.6596297", "0.6528794", "0.65138054", "0.65128595", "0.64982307", "0.64661014", "0.6447577", "0.6399733...
0.8579611
0
i. open a dialog to get in which user enters a file name to save ii. sets the text of given text entry to match file user selected
def saveFileAs(self, textEntry): textEntry.setText(QtGui.QFileDialog.getSaveFileName(self, 'Export'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getFileName(self, textEntry):\n textEntry.setText(QtGui.QFileDialog.getOpenFileName())\n textEntry.emit(QtCore.SIGNAL('FILE_SELECTED'))", "def browse( self ):\n Tk.Tk().withdraw()\n filename = askopenfilename( initialdir = self.initialdir,\n ...
[ "0.7600504", "0.7478386", "0.73535603", "0.7231459", "0.71452034", "0.7135394", "0.7072531", "0.6995552", "0.6995552", "0.6938619", "0.6937704", "0.6916023", "0.68937707", "0.68868494", "0.688312", "0.68801373", "0.6855539", "0.6847503", "0.68176925", "0.6816151", "0.68119866...
0.7488586
1
i. open a dialog to get in which user selects a file ii. sets the text of given text entry to match file user selected
def getFileName(self, textEntry): textEntry.setText(QtGui.QFileDialog.getOpenFileName()) textEntry.emit(QtCore.SIGNAL('FILE_SELECTED'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def browse_files_in(self,*args):\n path_to_data = tkFileDialog.askopenfilename()\n #show chosen value in textframe\n self.docstring.delete(0,tk.END)\n self.docstring.insert(0,path_to_data)\n #use chosen value as self.data_file\n self.data_file.set(path_to_data)", "def br...
[ "0.75972843", "0.7592121", "0.74247646", "0.73100656", "0.72838455", "0.7278615", "0.72531843", "0.72531843", "0.7165265", "0.71190333", "0.71152383", "0.7110643", "0.70934874", "0.7059284", "0.7045121", "0.68826526", "0.6851092", "0.6845944", "0.6842857", "0.6825622", "0.681...
0.7607524
0
i. open a dialog in which user selects a directory ii. sets the text of given text entry to match the directory the user selected
def openDirectory(self, textEntry): textEntry.setText(QtGui.QFileDialog.getExistingDirectory()) textEntry.emit(QtCore.SIGNAL("DIRECTORY_SELECTED"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def askForDir(self):\n self.dir = tkFileDialog.askdirectory(**self.dir_opt)\n self.textView.insert('end', 'Open %s\\n' % (self.dir))", "def browse( self ):\n Tk.Tk().withdraw()\n dirname = askdirectory()\n\n self.set_text( dirname )\n #rint( f\"get_text = {self.get_tex...
[ "0.79557335", "0.7627418", "0.7475416", "0.7445645", "0.73689944", "0.7321648", "0.72456354", "0.7223277", "0.7100498", "0.7093033", "0.70770675", "0.70672625", "0.70645624", "0.70553327", "0.7037435", "0.69944274", "0.69918424", "0.69603044", "0.68496865", "0.6845472", "0.68...
0.82809854
0
Number pattern '5' using Python for loop
def for_five(): for row in range(7): for col in range(5): if col==0 and row<6 and row!=4 or col>0 and col<3 and row%3==0 or col==3 and (row==0 or row>3) and row<6: print('*', end = ' ') else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def numbers():\n for number in range(1, 76):\n yield number", "def main():\n number = int(input())\n count = 0\n for i in range(1, number+1):\n if i%3 == 0 or i%5 == 0:\n count += i\n print(count)", "def compute_pattern(n):\n for x in range(1,n):\n for y in ran...
[ "0.65481997", "0.6515888", "0.65046096", "0.6434914", "0.62507683", "0.622045", "0.61105067", "0.61098456", "0.60892016", "0.6046951", "0.6010077", "0.5994545", "0.5919658", "0.5891623", "0.58706415", "0.58510786", "0.58489823", "0.58398044", "0.5836585", "0.58269024", "0.582...
0.58841646
14
Number pattern '5' using Python while loop
def while_five(): row = 0 while row<7: col = 0 while col<7: if col==0 and row<6 and row!=4 or col>0 and col<3 and row%3==0 or col==3 and (row==0 or row>3) and row<6: print('*', end = ' ') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n number = int(input())\n count = 0\n for i in range(1, number+1):\n if i%3 == 0 or i%5 == 0:\n count += i\n print(count)", "def count_to10():\n numberx = 0\n while numberx < 10:\n numberx += 1\n print(numberx)", "def renumber():\n\n counter = it...
[ "0.655466", "0.6519697", "0.6449413", "0.63978386", "0.6332752", "0.62820756", "0.62544936", "0.6229543", "0.6160936", "0.6065578", "0.60082173", "0.5853708", "0.58360726", "0.5816996", "0.57952696", "0.5790483", "0.57858884", "0.57809883", "0.5776131", "0.57704246", "0.57674...
0.6221141
8
r"""SqueezeNet 1.1 model from the `official SqueezeNet repo
def squeezenet1_1(pretrained=False, strides=(2, 2, 2, 2, 2), inter_features=True, progress=True, **kwargs): return _squeezenet('1_1', pretrained, strides, inter_features, progress, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_model(self):\n if self.model_type=='densenet_121':\n model = self.make_densenet_121(self.weights)\n\n\n return model", "def semnasnet_140(pretrained=False, num_classes=1000, in_chans=3, **kwargs):\n default_cfg = default_cfgs['semnasnet_140']\n model = _gen_mnasnet_a1(1.4,...
[ "0.62322503", "0.6004179", "0.58528733", "0.58489287", "0.5771156", "0.5702672", "0.5666888", "0.5656912", "0.5635127", "0.5634268", "0.5623376", "0.56212634", "0.5604558", "0.5600158", "0.5548424", "0.55420846", "0.55333906", "0.55195224", "0.55142236", "0.55047935", "0.5491...
0.0
-1
This method is used for the keystroke grading in the application. The data in retrieved from the database. This data is then used in the grading process. The user selects a key and that key then performs a task. There is a queue which loads the key selections which is used to add the marks and comments to the students ...
def startGrading(event): window.unbind("<s>", bind_id) cur.execute( "SELECT comment1, comment2, comment3, comment4, comment5 FROM cannedComments WHERE user_id =%s and moduleCode = %s and assignmentNo = %s", (userID, assignmentModuleCode, assignmentNo)) fetchedComments = c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submitAssignment(self, _event=None):\n assignmentFilePath = AccessingFiles.getFilepath()\n cur.execute(\n \"SELECT * FROM assignments WHERE user_id =%s and student_id = %s and filename = %s and moduleCode = %s and assignmentNo = %s\",\n (userID, selection, it...
[ "0.61789244", "0.5682106", "0.55871874", "0.5540368", "0.5355401", "0.5321885", "0.5302319", "0.51488197", "0.51355994", "0.51158065", "0.5112609", "0.5047955", "0.50102323", "0.49364117", "0.4906312", "0.48952746", "0.4892012", "0.4890522", "0.48756707", "0.48665848", "0.484...
0.6797914
0
This method is used to highlight text in the student assignment. Firstly, the PDF is saved which does not include the highlighted text. The pdf is then opened and the text from the HighlightedText.txt file is copied and the the fitz module in python locates the text in the pdf and then adds a yellow background to the t...
def highlightingTextInFile(): savingFilePDF = re.sub('\t', '', item_text[0] + ".pdf") doc = fitz.open(gradedFilesFolder + "\\" + savingFilePDF) page = doc[0] with open(newTextFile, "r") as file2: time.sleep(0.5) text1 = file2.read() # Search for the text...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlight(self):\n\n if self.selected_text_file is None:\n return\n if self.selected_text_file[FULLTEXT] is None:\n return\n format_ = QtGui.QTextCharFormat()\n cursor = self.ui.textBrowser.textCursor()\n for item in self.case_text:\n try:\n ...
[ "0.65989536", "0.6505804", "0.6054621", "0.60322046", "0.60036427", "0.5864477", "0.57321054", "0.5600204", "0.55730855", "0.54676825", "0.54027605", "0.53352803", "0.5305688", "0.528708", "0.51586694", "0.51586694", "0.51586694", "0.5149887", "0.5149887", "0.51426286", "0.51...
0.83719736
0
If there us a mouse click on the text box or a new line is entered in the text box it will load the line numbers.
def _on_change(self, event): self.codeLineNumbers.redraw()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_counter(self, event=None):\n try:\n text_area = self.get_current()\n self.canvas.delete('all')\n i = text_area.index(\"@0,0\")\n while True:\n dline = text_area.dlineinfo(i)\n if dline is None: break\n y = dlin...
[ "0.68388116", "0.6638847", "0.63189745", "0.62623847", "0.622727", "0.613175", "0.5789219", "0.5706336", "0.5689253", "0.56639355", "0.5612356", "0.56078994", "0.55938995", "0.55646855", "0.55344325", "0.5507554", "0.5504534", "0.5494389", "0.5490965", "0.54685616", "0.546091...
0.6135949
5
This method copies the code in the assignment grading text box and creates a pdf file which will be used in order to highlight text
def savePDFFile(self): s = self.text.get("1.0", tk.END) f = open(file, "w", encoding='utf-8') f.write(s) f.close() # Create a file for each student with their graded files pdf = FPDF() pdf.add_page() pdf.set_font("Arial", s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlightingTextInFile():\n savingFilePDF = re.sub('\\t', '', item_text[0] + \".pdf\")\n doc = fitz.open(gradedFilesFolder + \"\\\\\" + savingFilePDF)\n page = doc[0]\n\n with open(newTextFile, \"r\") as file2:\n time.sleep(0.5)\n text1 = file2.read()\n\n ...
[ "0.6238947", "0.58214", "0.5817242", "0.5786519", "0.57760084", "0.57760084", "0.57760084", "0.57224184", "0.56881684", "0.56578857", "0.56418467", "0.5640361", "0.5613223", "0.56121486", "0.5571742", "0.5571385", "0.555584", "0.5549019", "0.553231", "0.55292517", "0.54780155...
0.70820236
0
This method is used to submit the students assignment grade to the database. If a grade for the student already exists in the database and the user selects that assignment for grading, they will be prompted with an message box asking if they want to regrade the assignment. If they select yes then they can regrade the a...
def submitAssignment(self, _event=None): assignmentFilePath = AccessingFiles.getFilepath() cur.execute( "SELECT * FROM assignments WHERE user_id =%s and student_id = %s and filename = %s and moduleCode = %s and assignmentNo = %s", (userID, selection, item_text[0],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save_grade(self):\r\n student = self._student('POST', key='grader_id')\r\n if student is None:\r\n self._error_response()\r\n\r\n else:\r\n # Update the number of essays the student has graded\r\n student.grade_peer_essay()\r\n return self._succ...
[ "0.6543872", "0.63892865", "0.633533", "0.6332422", "0.63317186", "0.63130635", "0.62545836", "0.6071485", "0.6068624", "0.6017599", "0.59676605", "0.59659773", "0.59341687", "0.5874737", "0.57972556", "0.5783686", "0.5766519", "0.5579791", "0.55714285", "0.556687", "0.555967...
0.8227006
0
Adds the highlighted text in the assignment grading window to the HighlightedText.txt file
def highlightCode(self, _event=None): count = 0 if self.text.tag_ranges('sel'): self.text.tag_add('color' + str(count), tk.SEL_FIRST, tk.SEL_LAST) self.text.tag_configure('color' + str(count), foreground='black', background='yellow') count += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def highlightingTextInFile():\n savingFilePDF = re.sub('\\t', '', item_text[0] + \".pdf\")\n doc = fitz.open(gradedFilesFolder + \"\\\\\" + savingFilePDF)\n page = doc[0]\n\n with open(newTextFile, \"r\") as file2:\n time.sleep(0.5)\n text1 = file2.read()\n\n ...
[ "0.7374293", "0.6817336", "0.64692134", "0.6182169", "0.6022382", "0.59503573", "0.58533984", "0.5805103", "0.5790315", "0.57207805", "0.56802523", "0.5655003", "0.5655003", "0.56214184", "0.5620613", "0.55651665", "0.5480074", "0.547468", "0.5472067", "0.5469422", "0.5457528...
0.6832632
1
This method adds the marks and comments generated from the keystrokes into the students assignment
def addAssignmentComments(self, _event=None): self.text.insert(tk.END, "\n") self.text.insert(tk.INSERT, assignmentCommentsBox.get("1.0", "end-1c"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startGrading(event):\n window.unbind(\"<s>\", bind_id)\n cur.execute(\n \"SELECT comment1, comment2, comment3, comment4, comment5 FROM cannedComments WHERE user_id =%s and moduleCode = %s and assignmentNo = %s\",\n (userID, assignmentModuleCode, assignmentNo))\n fetch...
[ "0.55127954", "0.55074334", "0.53589535", "0.53228885", "0.5216916", "0.52080244", "0.5189307", "0.5166053", "0.5159105", "0.515391", "0.51526713", "0.50940263", "0.5013002", "0.5001225", "0.49976295", "0.49926817", "0.4991195", "0.4941163", "0.49386635", "0.49113652", "0.490...
0.60720026
0
If window is closed mid grading a message box display
def on_closingWindow(self): if messagebox.askokcancel("Quit", "Do you want to quit grading the assignment?\n File will be saved", parent=window): self.submitAssignment()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __window_close(self):\n pass", "def message_box(self):\n root = tk.Toplevel(self.top)\n root.attributes('-topmost', True)\n root.geometry(\"+650+100\")\n root.withdraw()\n messagebox.showinfo('Oh oh', 'Wrong message. Try again!')\n try:\n root.destr...
[ "0.73147106", "0.7060031", "0.69775015", "0.6929832", "0.6904085", "0.687413", "0.68636405", "0.68604046", "0.6857272", "0.6853422", "0.6843845", "0.68172044", "0.6751769", "0.6727031", "0.6711077", "0.669814", "0.669641", "0.66409177", "0.6637147", "0.66262764", "0.6613843",...
0.74814725
0
If window is closed mid grading a message box display
def back(self, _event=None): self.on_closingWindow()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_closingWindow(self):\n if messagebox.askokcancel(\"Quit\",\n \"Do you want to quit grading the assignment?\\n File will be saved\",\n parent=window):\n self.submitAssignment()", "def __window_close(self):\n...
[ "0.7481806", "0.73158485", "0.705738", "0.6976617", "0.69277674", "0.6903606", "0.68744737", "0.6865453", "0.68603915", "0.6857267", "0.6853163", "0.6844235", "0.68156856", "0.6752026", "0.672771", "0.67103666", "0.66975254", "0.6696275", "0.6640213", "0.66379935", "0.6627065...
0.0
-1
write_ROMS_grid(grd, filename) Write ROMS_CGrid class on a NetCDF file.
def write_ROMS_grid(grd, visc_factor, diff_factor, filename='roms_grd.nc'): Mm, Lm = grd.hgrid.x_rho.shape # Write ROMS grid to file nc = netCDF.Dataset(filename, 'w', format='NETCDF4') nc.Description = 'ROMS grid' nc.Author = 'Trond Kristiansen' nc.Created = datetime.now().isoformat() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_cdo_grid(self, outfile):", "def save_mrc(grid_object, path):\n\n return MRC_Grid_Write(grid_object, path)", "def write_shapefile(self, filename='grid.shp', epsg=None, prj=None):\n from ..export.shapefile_utils import write_grid_shapefile2\n if epsg is None and prj is None:\n ...
[ "0.65927523", "0.64591205", "0.64300597", "0.63076574", "0.62848854", "0.62485576", "0.6131454", "0.6101492", "0.605749", "0.6021716", "0.5946283", "0.5857305", "0.576592", "0.57481474", "0.5727841", "0.572196", "0.57188284", "0.56795627", "0.56728095", "0.56445134", "0.56236...
0.7655568
0
Test Numeric array to VTK array conversion and viceversa.
def test_array2vtk(self): # Put all the test arrays here. t_z = [] # Test the different types of arrays. t_z.append(numpy.array([-128, 0, 127], numpy.int8)) # FIXME: character arrays are a problem since there is no # unique mapping to a VTK data type and back. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arr2cell_array(self):\n # Test list of lists.\n a = [[0], [1, 2], [3, 4, 5], [6, 7, 8, 9]]\n cells = array_handler.array2vtkCellArray(a)\n z = numpy.array([1, 0, 2, 1,2, 3, 3,4,5, 4, 6,7,8,9])\n arr = array_handler.vtk2array(cells.GetData())\n self.assertEqual(num...
[ "0.694688", "0.663548", "0.64812386", "0.6476549", "0.635363", "0.631881", "0.617769", "0.6159509", "0.614058", "0.60678095", "0.6061788", "0.5929297", "0.5926725", "0.59005785", "0.5837574", "0.5725261", "0.57149047", "0.5694535", "0.56775194", "0.5614327", "0.5610911", "0...
0.799915
0
Test Numeric array to vtkCellArray conversion.
def test_arr2cell_array(self): # Test list of lists. a = [[0], [1, 2], [3, 4, 5], [6, 7, 8, 9]] cells = array_handler.array2vtkCellArray(a) z = numpy.array([1, 0, 2, 1,2, 3, 3,4,5, 4, 6,7,8,9]) arr = array_handler.vtk2array(cells.GetData()) self.assertEqual(numpy.sum(arr ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_array2vtk(self):\n # Put all the test arrays here.\n t_z = [] \n\n # Test the different types of arrays.\n t_z.append(numpy.array([-128, 0, 127], numpy.int8))\n\n # FIXME: character arrays are a problem since there is no\n # unique mapping to a VTK data typ...
[ "0.62945616", "0.5984892", "0.59832245", "0.5936498", "0.5862382", "0.583198", "0.5802998", "0.5767916", "0.5704477", "0.5664202", "0.56276673", "0.55963475", "0.5492892", "0.54758745", "0.54539454", "0.54508984", "0.54035276", "0.53702885", "0.53439134", "0.53292114", "0.531...
0.7681079
0
Test Numeric array to vtkPoints conversion.
def test_arr2vtkPoints(self): a = [[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]] p = array_handler.array2vtkPoints(a) self.assertEqual(p.GetPoint(0), (0.0, 0.0, 0.0)) self.assertEqual(p.GetPoint(1), (1.0, 1.0, 1.0)) p = vtk.vtkPoints() ident = id(p) p = array_handler.array2vt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_array2vtk(self):\n # Put all the test arrays here.\n t_z = [] \n\n # Test the different types of arrays.\n t_z.append(numpy.array([-128, 0, 127], numpy.int8))\n\n # FIXME: character arrays are a problem since there is no\n # unique mapping to a VTK data typ...
[ "0.6521495", "0.64818186", "0.5970698", "0.595983", "0.5753924", "0.5726312", "0.5666946", "0.5626826", "0.5600705", "0.55829287", "0.55201954", "0.550375", "0.5496389", "0.5471823", "0.54700726", "0.54335093", "0.53982234", "0.53903526", "0.53780526", "0.5361564", "0.5358959...
0.7969096
0
Test array to vtkIdList conversion.
def test_arr2vtkIdList(self): a = [1, 2, 3, 4, 5] p = array_handler.array2vtkIdList(a) for i, j in enumerate(a): self.assertEqual(p.GetId(i), j) p = vtk.vtkIdList() ident = id(p) p = array_handler.array2vtkIdList(numpy.array(a), p) for i, j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_id_array(self):\n arr = vtk.vtkIdTypeArray()\n arr.SetNumberOfTuples(10)\n for i in range(10):\n arr.SetValue(i, i)\n\n np = array_handler.vtk2array(arr)\n self.assertEqual(numpy.all(np == range(10)), True)", "def mkVtkIdList(self, it):\n vil = vtk.vt...
[ "0.7677187", "0.647352", "0.59208304", "0.5762081", "0.57502407", "0.5743467", "0.5742972", "0.57179093", "0.56799865", "0.56706077", "0.5654017", "0.5637075", "0.5625911", "0.55883914", "0.55837685", "0.55628437", "0.5555486", "0.55226254", "0.5453243", "0.54327404", "0.5366...
0.8411601
0
Test multiple signature cases that have array arguments.
def test_get_correct_sig(self): obj = tvtk_base.TVTKBase(vtk.vtkIdTypeArray) sigs = [ None, [['vtkDataArray']], [['int', 'vtkIdList']], [['int', 'vtkPoints'], ['int', 'int']], [['int', 'vtkPoints'], ['int']], [['int'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_handler_array(self):\n\n @intent_handler\n def decorated_test(arr: List[str]):\n return arr\n\n r = create_request(\n \"TEST_CONTEXT\",\n arr=[\n \"31-12-2001\",\n \"31-12-1001\",\n ],\n )\n result...
[ "0.6318285", "0.6172812", "0.6162404", "0.610861", "0.6058716", "0.605753", "0.6045802", "0.60229707", "0.59978545", "0.59901863", "0.5983605", "0.59537596", "0.59348905", "0.5915856", "0.5899093", "0.5764791", "0.57222784", "0.57166", "0.568288", "0.56676954", "0.5647761", ...
0.65782744
0
Test if dereferencing array args works correctly.
def test_deref_array(self): sigs = [[['vtkDataArray']], [['vtkFloatArray']], [['vtkCellArray']], [['vtkPoints']], [['int', 'vtkIdList']], [['int', ('float', 'float'), 'vtkDataArray']], [['Prop', 'int', 'vtkDataArray'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ptr_or_array(*args):\n return _ida_hexrays.is_ptr_or_array(*args)", "def lookup_array(self, *args, **kwargs): # real signature unknown\n pass", "def lookup_array(self, *args, **kwargs): # real signature unknown\n pass", "def _check_args(self, args_):\n\n pass", "def test_vargs(...
[ "0.6318977", "0.60770243", "0.60770243", "0.59743184", "0.5915152", "0.5903806", "0.58661574", "0.5851228", "0.58363134", "0.57874745", "0.57700723", "0.55881095", "0.5572754", "0.5562253", "0.55080026", "0.5481902", "0.54778504", "0.5451302", "0.54414076", "0.5424659", "0.54...
0.6638242
0
Does to_array return an existing array instead of a new copy.
def test_reference_to_array(self): arr = numpy.arange(0.0, 10.0, 0.1) arr = numpy.reshape(arr, (25, 4)) vtk_arr = array_handler.array2vtk(arr) arr1 = array_handler.vtk2array(vtk_arr) # Now make sure these are using the same memory. arr[0][0] = 100.0 self.assertEq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_array(self) -> np.ndarray:\n return self.A", "def to_numpy(self) -> np.ndarray:\n return np.stack([x.to_numpy() for x in self])", "def asarray(self):\n from numpy import asarray\n return asarray(self)", "def to_numpy(self) -> np.ndarray:\n log_advice(\n \"...
[ "0.7306779", "0.72532874", "0.7197511", "0.7167543", "0.7166795", "0.7116745", "0.7113778", "0.70606464", "0.6982097", "0.68873906", "0.68387365", "0.67512727", "0.6690724", "0.669039", "0.6492112", "0.64499694", "0.63818926", "0.63742393", "0.6354882", "0.6346695", "0.632135...
0.0
-1
Test the ArrayCache class.
def test_array_cache(self): cache = array_handler.ArrayCache() # Test if len works. self.assertEqual(len(cache), 0) arr = numpy.zeros(100, float) varr = vtk.vtkFloatArray() # test contains self.assertEqual(varr not in cache, True) cache.add(varr, arr) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_untimed(self):\n cache = TimedCache()\n for i in range(500):\n cache[i] = i\n for i in range(500):\n assert i in cache\n assert cache[i] == i", "def test__cache(self):\n # Access to a protected member _cache of a client class\n # pylint...
[ "0.68710124", "0.67767155", "0.6772086", "0.65992814", "0.65391827", "0.6536076", "0.6400671", "0.6391623", "0.63568", "0.6338708", "0.62691534", "0.62381554", "0.6217318", "0.61316127", "0.60631394", "0.6057452", "0.6055985", "0.6038328", "0.60332614", "0.5990136", "0.598484...
0.8419209
0
Test if a vtkIdTypeArray is converted correctly.
def test_id_array(self): arr = vtk.vtkIdTypeArray() arr.SetNumberOfTuples(10) for i in range(10): arr.SetValue(i, i) np = array_handler.vtk2array(arr) self.assertEqual(numpy.all(np == range(10)), True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_arr2vtkIdList(self):\n a = [1, 2, 3, 4, 5]\n p = array_handler.array2vtkIdList(a)\n for i, j in enumerate(a): \n self.assertEqual(p.GetId(i), j)\n p = vtk.vtkIdList()\n ident = id(p)\n p = array_handler.array2vtkIdList(numpy.array(a), p)\n ...
[ "0.7641578", "0.6041027", "0.59939146", "0.5906016", "0.57242924", "0.5714401", "0.57085663", "0.56843495", "0.55889595", "0.5541299", "0.5535113", "0.55233514", "0.5509437", "0.5506507", "0.5470009", "0.5457422", "0.5454575", "0.54334915", "0.5413795", "0.54070187", "0.54061...
0.8161448
0
Translates litteral expression to float.
def letters_to_float(let): expr = str(let[1] # integer part + '.' + let[2:] # decimals + 'e' + _exponents[let[0].lower()] # exponent ) try: return (1 - 2*let[0].isupper())*float(expr) except ValueError: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value(self):\n float_str = first_token(self._node).spelling\n\n # Remove any C-specific suffix (f, F, l, L) so we can use Python's\n # float constructor to parse the string.\n float_str = re.sub(r'^(.*)[fFlL]$', r'\\1', float_str)\n\n return float(float_str)", "def str2floa...
[ "0.67611974", "0.67190254", "0.6670269", "0.6612682", "0.65358835", "0.64978874", "0.64675283", "0.64648813", "0.6441169", "0.6389028", "0.63695776", "0.63611645", "0.6360769", "0.6319111", "0.63145465", "0.63025874", "0.6297094", "0.6258761", "0.62507975", "0.6248428", "0.62...
0.64909846
6
Translates float to litteral expression.
def float_to_letters(flo): try: expo_int = int(floor(log10(abs(flo)))) # integer exponent expo_let = list(_exponents.keys())[list(_exponents.values()).index( '%i' % expo_int # corresponding letter exponent )] except TypeError: return '' # return empty string if input type is not recognisable...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def float(x) -> float:\n pass", "def _parse_float(\n value_expr: str, target_expr: str, ref_parts: List[str],\n a_type: mapry.Float, auto_id: mapry.py.generate.AutoID) -> str:\n uid = auto_id.next_identifier()\n\n return _PARSE_FLOAT_TPL.render(\n uid=uid,\n value_expr=value_ex...
[ "0.6342761", "0.6320651", "0.6213092", "0.6203347", "0.6141952", "0.6121117", "0.61017215", "0.6098951", "0.6050367", "0.6024089", "0.59904677", "0.5978502", "0.59352803", "0.592038", "0.59183156", "0.5900775", "0.58872736", "0.586948", "0.58320737", "0.58320016", "0.58029497...
0.0
-1
Set data, get the highest/lowest value and calculate the total and steps
def __set_temperatures(self): while True: temp = self.__get_correct_input() if temp != self.__QUIT_COMMAND: self.__total += temp self.__steps += 1 if temp > self.__highest: self.__highest = temp if temp < self.__lowest: self.__lowest = temp if temp < self.__LOW_TEMPERATURE_ALARM: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(self, data):\n\t\t#######################################################################\n\t\t# ** START OF YOUR CODE **\n\t\t#######################################################################\n\t\treturn (data-self.data_min)/(self.data_max-self.data_min)\n\t\t################...
[ "0.63865316", "0.6036022", "0.59460676", "0.5855021", "0.58470994", "0.58068866", "0.57772464", "0.5775998", "0.56909174", "0.5690023", "0.56552947", "0.56500727", "0.5647984", "0.5621928", "0.56047326", "0.5590412", "0.55899316", "0.55533165", "0.55443025", "0.55302304", "0....
0.53003895
52
Reset all record and get ready for another calculation
def __reset(self): self.__highest = -float('inf') self.__lowest = float('inf') self.__total = 0 self.__steps = 0 self.__cold_days = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.calc1.reset()\n self.calc2.reset()\n self.calc3.reset()\n self.calc4.reset()\n self.calc5.reset()\n self.calc6.reset()\n self.calc7.reset()\n self.calc8.reset()\n self.calc9.reset()\n self.calc10.reset()", "def reset(se...
[ "0.77041435", "0.74155897", "0.7388335", "0.73420775", "0.73420775", "0.73397404", "0.719545", "0.71558064", "0.71446407", "0.7093807", "0.7093807", "0.7093807", "0.70556104", "0.7054783", "0.7039421", "0.70392364", "0.70332664", "0.7028386", "0.70257473", "0.7018025", "0.701...
0.0
-1
To make sure the input is a number
def __get_correct_input(self): while True: temp = input(f'Next Temperature: (or {self.__QUIT_COMMAND} to quit)? ') try: return int(temp) except ValueError: print('The input is not valid')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CheckNumber(userInput):\n try:\n float(userInput)\n return True\n except(ValueError):\n return False", "def is_number(n):\n return isinstance(n, (int, float))", "def is_number(value):\n try:\n int(value)\n return True\n except (ValueError, TypeError):\n ...
[ "0.7778431", "0.765497", "0.75661147", "0.75186193", "0.75132155", "0.74904877", "0.7482881", "0.7475753", "0.7475029", "0.74599016", "0.74503165", "0.7442724", "0.74308676", "0.7423358", "0.74220467", "0.737716", "0.7367973", "0.73571527", "0.73452747", "0.73430526", "0.7327...
0.0
-1
Builds a `ModelResults` object from training and testing data.
def from_data(cls, model_params, y_train, train_preds, y_test, test_preds, trace, target_col): train_preds, test_preds = utils.cap_train_and_test_predictions( train_preds, test_preds) start = len(train_preds) end = start + len(test_preds) results_dict = util...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self): \n start_time = time()\n\n # reset previous results\n self.best_result = pd.DataFrame()\n self.result = pd.DataFrame()\n\n # Generate dictionaries of all posible parameter permutations\n keys, values = zip(*self.params.items())\n self.permuta...
[ "0.646548", "0.6221923", "0.62212306", "0.61293733", "0.6127586", "0.6083793", "0.60787904", "0.6065964", "0.60605586", "0.60277426", "0.6002492", "0.5993392", "0.5984186", "0.5919606", "0.59128535", "0.591156", "0.58957183", "0.58578795", "0.58560926", "0.5815098", "0.581071...
0.0
-1
Builds null model results. A null model results object is a `ModelResults` object in which all values are null. Returns ModelResults A null `ModelResults` object.
def build_null_model_results(cls): results_dict = {results_col: np.nan for results_col in specs.RESULTS_COLS} harvest_stats_dict = { buffer_pct: HarvestStats.build_null_harvest_stats() for buffer_pct in specs.BUFFER_PCTS} return cls({}, results_dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __unwrapResults(self):\n if self.__cachedResults is None:\n if self.__rawInfo.results is not None:\n resultList = json.loads(self.__rawInfo.results)\n assert len(resultList) == 2, \\\n \"Expected 2 elements, but got %s (%s).\" % (\n len(resultList), resultList...
[ "0.6237484", "0.5802736", "0.5723429", "0.5420379", "0.539289", "0.5236211", "0.5229382", "0.51973647", "0.51388884", "0.51044345", "0.50627637", "0.5057253", "0.49960345", "0.49328384", "0.49274898", "0.49107206", "0.48796177", "0.4867561", "0.48638237", "0.48547965", "0.485...
0.78038603
0
Gets the model results columns. These are the names of the variables of the `ModelResults` object, appearing in the same order as the list representation of the model results. Returns list A list of strings representing the names of the columns of the `ModelResults` object.
def get_model_results_cols(self): harvest_cols = HarvestStats.get_harvest_columns_for_buffers() return ["params"] + specs.RESULTS_COLS + harvest_cols
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_columns(self):\n columns = []\n for column in self.columns:\n columns.append(column.data.name)\n return columns", "def columns(self):\n result = self.execute(self.commands.table_columns(self.name))\n return [x[0] for x in result]", "def columns(self, model=...
[ "0.68451345", "0.6789725", "0.6645704", "0.65304536", "0.65295225", "0.6463279", "0.64613503", "0.6439484", "0.6391215", "0.6350888", "0.63452", "0.6339204", "0.63063014", "0.63024807", "0.6265027", "0.626092", "0.6218528", "0.62119365", "0.6211512", "0.6210677", "0.6204148",...
0.7914969
0
The model parameters associated with the results. Returns tuple A tuple specifying the model parameters associated with the results.
def get_model_params(self): return self._model_params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters(self):\n return self.model.parameters()", "def get_model_params(self):\n\n results = self._model.fit()\n model_params = np.expand_dims(results.params.as_matrix(), 1)\n return model_params", "def get_model_params(self):\n w1 = self.w1\n b1 = self.b1\n ...
[ "0.75586253", "0.7419984", "0.726825", "0.7237327", "0.7097789", "0.7016339", "0.70153385", "0.6999316", "0.69914156", "0.6953252", "0.6940094", "0.6927716", "0.69131255", "0.69131255", "0.69131255", "0.6862749", "0.6862749", "0.68351525", "0.68345207", "0.68340087", "0.68340...
0.72877127
2
Retrieves the model results. Returns dict A dictionary containing the model results.
def get_model_results(self): return self._results_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results(self):\n return extract_results(self.model)", "def get_results(self):\n return self.results", "def get_results(self):\n return self.results", "def GetResults(self):\n return self._results", "def get_results(self):\n return self.result", "def get_results(self):\n...
[ "0.76512617", "0.7250927", "0.7250927", "0.7165058", "0.71104646", "0.7065672", "0.6948484", "0.6898489", "0.67698526", "0.6763811", "0.6760713", "0.6705164", "0.66972226", "0.66972226", "0.66551745", "0.6650503", "0.6627542", "0.6627542", "0.6627542", "0.66273904", "0.659701...
0.82414335
0
Converts the model results to a list. Returns list A 9element list consisting of the model parameters and 8 floats representing the model results.
def to_list(self): model_lst = [self._model_params] for result in specs.RESULTS_COLS: model_lst.append(self._results_dict[result]) for buffer_pct in specs.BUFFER_PCTS: model_lst.extend(self._harvest_stats_dict[buffer_pct].to_list()) return model_lst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_of_results(self):\n return self.__result_list", "def __to_list(__results):\n rows = []\n for row in __results:\n rows.append(row)\n \n __results.close()\n\n return rows", "def results(self) -> list:\n return self._...
[ "0.68007237", "0.67216784", "0.66928416", "0.6679285", "0.6616853", "0.66016215", "0.6484065", "0.6437642", "0.6435629", "0.6417909", "0.6390932", "0.63305646", "0.6188584", "0.6112668", "0.6065527", "0.60347897", "0.60145533", "0.6003021", "0.6002833", "0.59735084", "0.59684...
0.7711234
0
Checks if the model results are better than `other_model_results`. The current model results are better than `other_model_results` if the `HarvestStats` at the lowest buffer percentage are better than the `HarvestStats` at the same buffer percentage in `other_model_results`.
def is_better(self, other_model_results): buffer_pct = specs.TUNING_BUFFER_PCT return self._harvest_stats_dict[buffer_pct].is_better( other_model_results._harvest_stats_dict[buffer_pct])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_thresholded_data_with_models(self):\n pass", "def report_result(\n self,\n result: Mapping[str, Any],\n model: nn.Module,\n epoch: int,\n ) -> bool:\n metric = get_from_nested_dict(result, key=self.key, default=None)\n if metric is None:\n ...
[ "0.6502473", "0.62888247", "0.62768865", "0.6213037", "0.6123758", "0.6072899", "0.6068795", "0.5921778", "0.58675754", "0.58598775", "0.5847968", "0.5845987", "0.581194", "0.57880193", "0.5772249", "0.5712979", "0.5709731", "0.5681822", "0.5666867", "0.5664734", "0.56527406"...
0.83155894
0
Converts array whose rows represent diagonal entries of a matrix into the matrix itself. See scipy.linalg.solve_banded
def diag_to_matrix(l_and_u, diag): l, u = l_and_u dim = diag.shape[1] matrix = np.zeros((dim, dim)) for i in range(l+u+1): np.fill_diagonal( matrix[max(0,i-u):,max(0,u-i):], diag[i,max(0,u-i):] ) return matrix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inv_banded(banded_matrix):\n banded_matrix = banded_matrix.toarray()\n nrows = banded_matrix.shape[0]\n nbands = np.min([np.count_nonzero(row) for row in banded_matrix])\n ab = np.zeros((nbands, nrows))\n for i in np.arange(1, nbands):\n ab[i, :] = np.concatenate(\n (\n ...
[ "0.69575876", "0.64048153", "0.6234123", "0.6205045", "0.61761206", "0.6006811", "0.59896874", "0.5946012", "0.5924541", "0.589005", "0.58739597", "0.58455795", "0.58453", "0.5809746", "0.58006567", "0.5790228", "0.57842326", "0.57267654", "0.5726118", "0.5716055", "0.5690097...
0.5298268
86
Given an array of points which define a bezier curve, and two numbres 0<=a<b<=1, return an array of the same size, which describes the portion of the original bezier curve on the interval [a, b]. This algorithm is pretty nifty, and pretty dense.
def partial_bezier_points(points, a, b): a_to_1 = np.array([ bezier(points[i:])(a) for i in range(len(points)) ]) return np.array([ bezier(a_to_1[:i+1])(b) for i in range(len(points)) ])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qbezier_bounds((x0, y0), (x1, y1), (x2, y2)):\n\n\t# cubic Bezier reprsented in polynomial base\n\t# f(t) = A*t^2 + B*t + C\n\tAx = x0 - 2*x1 + x2\n\tBx = -2*x0 + 2*x1\n\tCx = x0\n\n\tAy = y0 - 2*y1 + y2\n\tBy = -2*y0 + 2*y1\n\tCy = y0\n\n\t# find extremas:\n\t#\t1) x(0) = x0\n\t#\t2) x(1) = x2\n\t...
[ "0.6650105", "0.6489684", "0.64395845", "0.63854486", "0.6252875", "0.62005275", "0.61200774", "0.60908455", "0.6059499", "0.6040542", "0.6017206", "0.6016763", "0.59797376", "0.59575784", "0.5947453", "0.58710194", "0.58644146", "0.5855325", "0.58526003", "0.5766097", "0.576...
0.788962
0
Used instead of list(set(l)) to maintain order
def remove_list_redundancies(l): return sorted(list(set(l)), lambda a, b : l.index(a) - l.index(b))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dedup_list(l):\n return list(set(l))", "def sort_4(l):\n l = list(set(l))\n l.sort()", "def list_remove_duplicates(l):\n seen = set()\n seen_add = seen.add\n return [x for x in l if not (x in seen or seen_add(x))]", "def _unique(li):\n return list(set(li))", "def remove_duplicates(...
[ "0.76383084", "0.7485584", "0.73525107", "0.72422785", "0.71003187", "0.7076367", "0.7041976", "0.7040292", "0.6993371", "0.6865298", "0.68229544", "0.6761196", "0.67215854", "0.6655654", "0.6635181", "0.66209424", "0.6594591", "0.6577758", "0.6537239", "0.6518429", "0.651641...
0.74946845
1
Used instead of list(set(l1).update(l2)) to maintain order, making sure duplicates are removed from l1, not l2.
def list_update(l1, l2): return filter(lambda e : e not in l2, l1) + list(l2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _merge_lists(cls, li1, li2):\n if not li1:\n return li2[:]\n elif not li2:\n return li1[:]\n else:\n li = li1[:]\n for el in li2:\n if el not in li:\n li.append(el)\n return li", "def remove_repeated...
[ "0.7263704", "0.7154067", "0.68808377", "0.6878345", "0.6875592", "0.68290365", "0.6800653", "0.6670713", "0.66259474", "0.6581514", "0.65448564", "0.64174837", "0.6396892", "0.6333746", "0.6276453", "0.6201921", "0.6175894", "0.61337626", "0.6115901", "0.6112074", "0.6100564...
0.73580694
0
Useful so that classes or instance of those classes can be included in configuration, which can prevent defaults from getting created during compilation/importing
def instantiate(obj): return obj() if isinstance(obj, type) else obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _config_classes(self):\n pass", "def get_default_config(cls) -> Dict[str, Any]:\n\n def get_class_type(name: str, classes: dict):\n _cls = classes.get(name)\n if _cls is None:\n raise ValueError(f\"must be one of {list(classes)}: {name}\")\n retur...
[ "0.7530671", "0.6467715", "0.62749046", "0.62610245", "0.5953176", "0.5953176", "0.58759284", "0.5872104", "0.5839074", "0.5838956", "0.5824747", "0.5791095", "0.5787549", "0.57635665", "0.5731173", "0.5724937", "0.5696248", "0.5683502", "0.5683502", "0.56623834", "0.5659636"...
0.0
-1
Sets init args and CONFIG values as local variables The purpose of this function is to ensure that all configuration of any object is inheritable, able to be easily passed into instantiation, and is attached as an attribute of the object.
def digest_config(obj, kwargs, local_args = {}): ### Assemble list of CONFIGs from all super classes classes_in_heirarchy = [obj.__class__] configs = [] while len(classes_in_heirarchy) > 0: Class = classes_in_heirarchy.pop() classes_in_heirarchy += Class.__bases__ if hasattr(Clas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\r\n super().__init__()\r\n self._cfg = ConfigDict() # current configuration\r\n self._default_config = ConfigDict() # default configuration\r\n self._temp_config = OrderedDict() # temporary configuration\r\n self._path = Path() # current c...
[ "0.6853178", "0.6834196", "0.67961174", "0.6755883", "0.66611516", "0.651043", "0.64199936", "0.64155453", "0.64110464", "0.64090866", "0.6389923", "0.6379933", "0.6351718", "0.6345448", "0.6307715", "0.6305136", "0.6272914", "0.6256017", "0.625568", "0.62324893", "0.6221033"...
0.0
-1
Returns true of p0 is on the line between p1 and p2
def is_on_line(p0, p1, p2, threshold = 0.01): p0, p1, p2 = map(lambda tup : np.array(tup[:2]), [p0, p1, p2]) p1 -= p0 p2 -= p0 return abs((p1[0] / p1[1]) - (p2[0] / p2[1])) < threshold
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_line_on_line(feature_1: Sequence, feature_2: Sequence) -> bool:\n\n line_on_line = False\n\n for coords in feature_1:\n\n line_on_line = boolean_point_on_line(coords, feature_2)\n if not line_on_line:\n break\n\n return line_on_line", "def isPointOnLine(node1, node2, poin...
[ "0.7579855", "0.7464677", "0.7417148", "0.7244791", "0.70288116", "0.7003025", "0.6978226", "0.6792469", "0.6780732", "0.67776585", "0.67377263", "0.6728503", "0.6726889", "0.6713754", "0.6703011", "0.6701114", "0.66139954", "0.6600058", "0.65791726", "0.65495944", "0.6538196...
0.8123824
0
A "line" should come in the form [(x0, y0), (x1, y1)] for two points it runs through
def intersection(line1, line2): p0, p1, p2, p3 = map( lambda tup : np.array(tup[:2]), [line1[0], line1[1], line2[0], line2[1]] ) p1, p2, p3 = map(lambda x : x - p0, [p1, p2, p3]) transform = np.zeros((2, 2)) transform[:,0], transform[:,1] = p1, p2 if np.linalg.det(transform) == 0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line(x1, y1, x2, y2):\r\n\r\n x1 = normalize(x1)\r\n y1 = normalize(y1)\r\n x2 = normalize(x2)\r\n y2 = normalize(y2)\r\n\r\n xdiff = max(x1, x2) - min(x1, x2)\r\n ydiff = max(y1, y2) - min(y1, y2)\r\n xdir = 1 if x1 <= x2 else -1\r\n ydir = 1 if y1 <= y2 else -1\r\n\r\n r = max(xdif...
[ "0.8037015", "0.747192", "0.73408955", "0.7293409", "0.72838026", "0.7218734", "0.7174965", "0.7161783", "0.7159189", "0.7146811", "0.7055834", "0.70075125", "0.69622934", "0.6958971", "0.6946191", "0.69096845", "0.6909664", "0.68535465", "0.6849273", "0.6845207", "0.68186456...
0.0
-1
func_list should contain elements of the form (f, args)
def composition(func_list): return reduce( lambda (f1, args1), (f2, args2) : (lambda x : f1(f2(x, *args2), *args1)), func_list, lambda x : x )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_func_tuple(f_args):\n return f_args[0](*f_args[1:])", "def eval_f(f, xs):\n l = []\n for x in xs:\n l.append(f(x))\n return l", "def _parse_functions(self, locals: dict):\n functions_dict = dict(filter(self._isfunction, locals.items()))\n functions = []\n if not...
[ "0.66027486", "0.6527124", "0.6456615", "0.6453033", "0.6453033", "0.6453033", "0.6453033", "0.6453033", "0.64247805", "0.6411603", "0.6374968", "0.6369212", "0.63501984", "0.6339175", "0.6316425", "0.6316425", "0.63073343", "0.630301", "0.63011795", "0.62940806", "0.62505835...
0.60185134
33
Rotation in R^3 about a specified axess of rotation.
def rotation_matrix(angle, axis): about_z = rotation_about_z(angle) z_to_axis = z_to_vector(axis) axis_to_z = np.linalg.inv(z_to_axis) return reduce(np.dot, [z_to_axis, about_z, axis_to_z])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotate3(x, angle_x=0, angle_y=0, angle_z=0, origin=(0, 0, 0)):\n origin = np.asarray(origin)\n x = np.asarray(x) - origin\n r = rotation_matrix3(angle_x, angle_y, angle_z)\n return x.dot(r.T) + origin", "def rotation(self, p1, p2, p3):\n return (p2[0] - p1[0]) * (p3[1] - p1[1]) - (p2[1] - ...
[ "0.74250835", "0.72524756", "0.67635214", "0.67440736", "0.669359", "0.66566396", "0.6622887", "0.65798664", "0.65373707", "0.6528488", "0.6514331", "0.64939123", "0.6466822", "0.6451799", "0.64486176", "0.64481574", "0.64349747", "0.6420502", "0.64017946", "0.6375933", "0.63...
0.0
-1
Returns some matrix in SO(3) which takes the zaxis to the (normalized) vector provided as an argument
def z_to_vector(vector): norm = np.linalg.norm(vector) if norm == 0: return np.identity(3) v = np.array(vector) / norm phi = np.arccos(v[2]) if any(v[:2]): #projection of vector to unit circle axis_proj = v[:2] / np.linalg.norm(v[:2]) theta = np.arccos(axis_proj[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec(x, y=0.0, z=0.0):\n return np.matrix((x, y, z)).T", "def vector3(x, y, z):\n return np.array([x, y, z], dtype=float)", "def vector3(x, y, z):\n return np.array([x, y, z], dtype=np.float)", "def transl(x, y, z):\n displace_vector = [[x],\n [y],\n ...
[ "0.6809458", "0.65553045", "0.6546179", "0.6475817", "0.6406058", "0.63439775", "0.6271068", "0.6262496", "0.624025", "0.62375873", "0.62104046", "0.61708397", "0.612312", "0.61139035", "0.6109181", "0.6097854", "0.60896564", "0.6088202", "0.60877305", "0.60507977", "0.604126...
0.63574386
5
Returns polar coordinate theta when vector is project on xy plane
def angle_of_vector(vector): z = complex(*vector[:2]) if z == 0: return 0 return np.angle(complex(*vector[:2]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vector_polar(v):\n return vector_mag(v), vector_angle(v)", "def xy_rotation(vector,theta):\r\n R = np.array([[np.cos(theta), -np.sin(theta),0],\r\n [np.sin(theta), np.cos(theta),0],\r\n [0,0,1]\r\n ])\r\n return np.dot(R,vector)", "def get_phi_the...
[ "0.76956666", "0.7633337", "0.7338335", "0.6962628", "0.6891784", "0.68915886", "0.6874387", "0.6853124", "0.6806457", "0.67847264", "0.6771697", "0.6752571", "0.6683304", "0.6676678", "0.6538311", "0.6537484", "0.6536811", "0.6521249", "0.65063834", "0.6497525", "0.6476558",...
0.62594527
41
Create input dictionary for the calculation
def _init_calculation(self): # count number of previous calculations self.ctx.running_calc += 1 # set the structure self.ctx.inputs.structure = self.inputs.structure # # deal with oxidation states # if self.ctx.running_calc > 1 and self.ctx.try_oxi: # self.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_intermediate_dict(self) -> Dict[str, float]:\n intermediate = {}\n now = datetime.now()\n current_time = now.replace(hour=0, minute=0, second=0, microsecond=0)\n\n delta = timedelta(minutes=15)\n\n for i in range(0, 96):\n intermediate[self.date_to_intermedia...
[ "0.63354945", "0.630033", "0.6294846", "0.6259771", "0.62242556", "0.6103733", "0.6085816", "0.6063543", "0.6020394", "0.6008215", "0.5994665", "0.5992658", "0.5976904", "0.5975591", "0.59737456", "0.5971995", "0.59629464", "0.5956414", "0.59546196", "0.59536123", "0.59359044...
0.0
-1
Check if calculation is runnable, either as the original or as the restart
def runnable(self): if "calculations" not in self.ctx: return True # if no calculations have run return self.ctx.running_calc < 2 and self.can_restart()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_runnable(self):\n return self.state == self.STATE_INIT and not self.require", "def running(self) -> bool:", "def check_results(self):\n if not self.ctx.is_restart and self.can_restart():\n self.ctx.is_restart = True\n self.report('Calculation is not converged and rest...
[ "0.64345175", "0.64055866", "0.62883925", "0.6022785", "0.583515", "0.5817639", "0.5810944", "0.58060336", "0.58060336", "0.58060336", "0.57899654", "0.57723004", "0.5769942", "0.57578385", "0.5742459", "0.5721791", "0.57163495", "0.5706602", "0.5685521", "0.5668268", "0.5666...
0.7984654
0
Run a calculation from self.ctx.inputs
def run_calculation(self): process = CalculationFactory(self.ctx.calculation) running = self.submit(process, **self.ctx.inputs) return self.to_context(calculations=append_(running))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, inputs):\n for layer in self._layers:\n inputs = layer.calc(inputs)\n return inputs", "def calculate(self, inputs):\r\n output = inputs\r\n for layer in self.layers:\r\n output = layer.calculate(output)\r\n return output", "async def comput...
[ "0.73881614", "0.6835724", "0.66839474", "0.6677566", "0.65423274", "0.6541498", "0.6500944", "0.64942855", "0.6393293", "0.63920987", "0.6383449", "0.63411707", "0.6326243", "0.6325895", "0.63136935", "0.6313585", "0.6303633", "0.62906355", "0.62707853", "0.62667006", "0.626...
0.66676795
4
Check the calculation results, amend calculation inputs and make it restart if needed
def check_results(self): if not self.ctx.is_restart and self.can_restart(): self.ctx.is_restart = True self.report('Calculation is not converged and restart parameters are given: calc scheduled for restart')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n welcome_message()\n continue_program = True\n num_calculations = 0\n # all the calculation options in the program\n calculation_options = [\"addition\", \"subtraction\", \"division\",\n \"multiplication\", \"exponents\", \"circle area\",\n ...
[ "0.62992084", "0.62845427", "0.625051", "0.625051", "0.60817975", "0.6077046", "0.60698175", "0.6059078", "0.6044138", "0.6044028", "0.6036768", "0.60181826", "0.5992498", "0.5992498", "0.5992498", "0.59184784", "0.588707", "0.5873105", "0.5863846", "0.5855877", "0.5837538", ...
0.7682695
0
Process calculation results; adapted from aiida_vasp
def retrieve_results(self): # return the results of the last calculation last_calc = self.ctx.calculations[-1] # check exit status of a last calc if last_calc.exit_status not in (None, 0): self.report(f'The calculations failed with exit message: {last_calc.exit_message}') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_result(self, results, calc):\r\n lg = logging.getLogger(\"%s.%s\" % (self.ln, inspect.stack()[0][3]))\r\n lg.setLevel(self.log_level)\r\n # if the calculation is empty exit\r\n if calc is None:\r\n return results\r\n lg.debug(\"calc %s\", calc)\r\n # p...
[ "0.67349535", "0.66774166", "0.6657482", "0.65898657", "0.64503765", "0.64330107", "0.6363478", "0.63621926", "0.63179433", "0.6301655", "0.6234125", "0.62197614", "0.62122", "0.620175", "0.6156571", "0.61563945", "0.6110802", "0.6085085", "0.60796386", "0.607358", "0.6043771...
0.0
-1
Finalize calculation, clean remote directory if needed (adapted from aiidavasp)
def finalize(self): if not self.inputs.clean_workdir: return cleaned_calcs = [] for calculation in self.ctx.calculations: try: # noinspection PyProtectedMember calculation.outputs.remote_folder._clean() cleaned_calcs.append(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_terminated(self):\n super(PwBandsWorkChain, self).on_terminated()\n\n if self.inputs.clean_workdir.value is False:\n self.report('remote folders will not be cleaned')\n return\n\n cleaned_calcs = []\n\n for called_descendant in self.calc.called_descendants:\...
[ "0.6397654", "0.6368182", "0.61231685", "0.61225873", "0.6119665", "0.60274994", "0.6024973", "0.59868515", "0.593518", "0.5925773", "0.5923112", "0.591191", "0.5894966", "0.5868265", "0.5841424", "0.5815715", "0.580706", "0.5800703", "0.57971424", "0.57971424", "0.57971424",...
0.75777876
0
Create input dictionary for the calculation, deal with restart (later?)
def init_calculation(self): self.ctx.inputs = AttributeDict() # set the code self.ctx.inputs.code = self.inputs.code # set the wavefunction self.ctx.inputs.wavefunction = self.inputs.wavefunction # set parameters, giving the defaults self.ctx.inputs.parameters ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_intermediate_dict(self) -> Dict[str, float]:\n intermediate = {}\n now = datetime.now()\n current_time = now.replace(hour=0, minute=0, second=0, microsecond=0)\n\n delta = timedelta(minutes=15)\n\n for i in range(0, 96):\n intermediate[self.date_to_intermedia...
[ "0.6584127", "0.6164442", "0.6076059", "0.6046547", "0.60108364", "0.6010455", "0.60099846", "0.5975037", "0.59471935", "0.59418076", "0.5911587", "0.5910082", "0.5894325", "0.5836499", "0.5753927", "0.575177", "0.57376254", "0.5719721", "0.57039464", "0.56982744", "0.5694113...
0.57079095
18
Set defaults to calculation parameters
def _set_default_parameters(self, parameters): parameters_dict = parameters.get_dict() from aiida_crystal_dft.io.f9 import Fort9 with self.inputs.wavefunction.open(mode='rb') as f: file_name = f.name wf = Fort9(file_name) if 'band' in parameters_dict: # a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _default_parameters(cls) -> Options:\n params = super()._default_parameters()\n params.main_axes = None\n params.i_means = None\n params.q_means = None\n params.scales = None\n\n return params", "def set_default_parameters(self):\n super().set_default_paramete...
[ "0.6943066", "0.6919235", "0.6629486", "0.6605372", "0.65865785", "0.65397674", "0.6539674", "0.6494178", "0.64272714", "0.63984066", "0.63891405", "0.63767976", "0.6373579", "0.6346972", "0.63348526", "0.63092655", "0.6272867", "0.6268823", "0.62534904", "0.62277675", "0.622...
0.5884307
57
Run a calculation from self.ctx.inputs
def run_calculation(self): process = CalculationFactory(self._calculation) running = self.submit(process, **self.ctx.inputs) return self.to_context(calculations=append_(running))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, inputs):\n for layer in self._layers:\n inputs = layer.calc(inputs)\n return inputs", "def calculate(self, inputs):\r\n output = inputs\r\n for layer in self.layers:\r\n output = layer.calculate(output)\r\n return output", "async def comput...
[ "0.73888916", "0.68371904", "0.6684268", "0.6678672", "0.66685766", "0.65434", "0.6542864", "0.6502158", "0.63943106", "0.639336", "0.6384044", "0.63404804", "0.632782", "0.63258415", "0.6315129", "0.63148564", "0.63052267", "0.6290937", "0.6270991", "0.6267059", "0.62588346"...
0.64950955
8
Process calculation results; adapted from aiida_vasp
def retrieve_results(self): # return the results of the last calculation last_calc = self.ctx.calculations[-1] for name, port in self.spec().outputs.items(): if port.required and name not in last_calc.outputs: self.report('the spec specifies the output {} as required ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _calc_result(self, results, calc):\r\n lg = logging.getLogger(\"%s.%s\" % (self.ln, inspect.stack()[0][3]))\r\n lg.setLevel(self.log_level)\r\n # if the calculation is empty exit\r\n if calc is None:\r\n return results\r\n lg.debug(\"calc %s\", calc)\r\n # p...
[ "0.6734962", "0.6677146", "0.6657827", "0.65906954", "0.6450266", "0.6432466", "0.636254", "0.63616407", "0.6317594", "0.63020205", "0.62345845", "0.6220271", "0.62130886", "0.6202688", "0.6157641", "0.6157569", "0.6111835", "0.60845757", "0.60801816", "0.607423", "0.6044211"...
0.0
-1
Bryukh's solution >>> solution() 5482660
def solution(): pentagonals = [] n = 1 while True: newp = (n*(3*n-1))/2 for p in pentagonals: diff = abs(newp-p) if ispentagonal(diff) and ispentagonal(newp+p): return diff pentagonals.append(newp) n += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(s):", "def solution(self):\n return [(\"the\", 1579644)] * 100", "def solve(self):", "def exercise_b2_52():\r\n pass", "def solution(self) -> State:", "def exercise_b2_53():\r\n pass", "def exercise_b2_113():\r\n pass", "def exercise_b2_82():\r\n pass", "def solution(sel...
[ "0.7280032", "0.69121206", "0.66888416", "0.6620982", "0.6602587", "0.6577295", "0.6460368", "0.6443591", "0.64340264", "0.6396119", "0.6313636", "0.6311839", "0.62898034", "0.62776446", "0.62592465", "0.6256724", "0.6208561", "0.62069046", "0.61867815", "0.6186715", "0.61863...
0.0
-1
Will save the state so it can be restored later
def save(self): self.pushes.append((self.token, self.stream, self.line, self.column))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_state(self):\n pass", "def saveState(self) -> None:\n # TODO: Saves State\n pass", "def savestate(self, state):\n pass", "def save_state(self) -> None:\n raise NotImplementedError(\"Save state is is not implemented.\")", "def save(self, *args, **kwargs):\n ...
[ "0.9262114", "0.88588667", "0.8651228", "0.8636893", "0.8285493", "0.7981114", "0.7923887", "0.76744914", "0.7601485", "0.75755954", "0.7566344", "0.75488573", "0.7545564", "0.75297433", "0.743897", "0.74088436", "0.7294165", "0.7291157", "0.72792566", "0.7241757", "0.7219886...
0.0
-1
Will restore the state to the saved state
def restore(self): token, stream, line, col = self.pushes.pop() self.token = token self.stream = stream self.line = line self.column = col
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_state(self, state):\n state_ref = self.ale.decodeState(state)\n self.ale.restoreState(state_ref)\n self.ale.deleteState(state_ref)", "def restore(self):\n raise NotImplementedError", "def restore_state(self, state: ale_py.ALEState):\n self.ale.restoreState(state)"...
[ "0.81704223", "0.81169754", "0.80634177", "0.79704624", "0.7892635", "0.78692335", "0.7859833", "0.7734005", "0.7663427", "0.7634011", "0.7608364", "0.75698084", "0.75514317", "0.74182177", "0.73968023", "0.73769253", "0.73577315", "0.7354427", "0.73164636", "0.7300497", "0.7...
0.0
-1
Discard the last saved state
def discard(self): self.pushes.pop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_last_undo_point(self):\n self.unload()", "def revert_state(self):\n if self.previous_states > 0: # checks for empty\n self.update_status(self.previous_states.pop())", "def reset(self):\n self.history_states.clear()", "def reset_state(self):\n return dict(sel...
[ "0.70523554", "0.69862825", "0.6965245", "0.68354887", "0.67271405", "0.6689352", "0.66892314", "0.6631443", "0.6619713", "0.6613089", "0.6596752", "0.6594047", "0.659116", "0.6574138", "0.65437245", "0.65336823", "0.65235734", "0.6473415", "0.64700496", "0.6468176", "0.64681...
0.0
-1
Initialize parameters and build model. Params ======
def __init__(self, state_size, action_size, seed, fc_units=[128,128]): super(Actor, self).__init__() self.seed = torch.manual_seed(seed) self.fc = [] self.fc.append(nn.Linear(state_size, fc_units[0])) self.fc.append(nn.ReLU()) for i in range(1,len(fc_units)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n super(Model, self).__init__(**kwargs)\n self._params = self.find_params()", "def build_model():", "def build_model(self):\n pass", "def build_model(self):\n pass", "def __init__(self, param_dictionary):\n\n BaseModel.__init__(self)\n\n ...
[ "0.79983556", "0.77646637", "0.73733515", "0.73733515", "0.72585744", "0.7250074", "0.7170411", "0.71661454", "0.7156735", "0.70888656", "0.70778716", "0.70772207", "0.7069133", "0.70286226", "0.70094854", "0.697547", "0.69357735", "0.6890618", "0.6884159", "0.6858014", "0.68...
0.0
-1
Build an actor (policy) network that maps states > actions.
def forward(self, state): x = self.fc(state) return x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_actor_network(states, num_controls, params, scope_name):\n scope_key = scope_name + '/'\n with tf.variable_scope(scope_name):\n hidden_1 = tf.layers.dense(states,\n units=params.actor_hidden_units[0],\n activation=None,\n ...
[ "0.69361234", "0.6364334", "0.6270192", "0.6208838", "0.62005234", "0.6187673", "0.6147678", "0.61465186", "0.61283225", "0.6019157", "0.60020804", "0.5976981", "0.59597296", "0.59523076", "0.59488183", "0.5928019", "0.5916519", "0.58979034", "0.58936965", "0.5891595", "0.588...
0.0
-1
Initialize parameters and build model. Params ======
def __init__(self, state_size, action_size, seed, fc_units=[128, 128, 128]): super(Critic, self).__init__() self.seed = torch.manual_seed(seed) self.fc1 = nn.Sequential(nn.Linear(state_size, fc_units[0]), nn.ReLU()) self.fc2 = [] for i in range(1,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, **kwargs):\n super(Model, self).__init__(**kwargs)\n self._params = self.find_params()", "def build_model():", "def build_model(self):\n pass", "def build_model(self):\n pass", "def __init__(self, param_dictionary):\n\n BaseModel.__init__(self)\n\n ...
[ "0.79974955", "0.77619344", "0.7370926", "0.7370926", "0.72581285", "0.7249673", "0.71711296", "0.71638674", "0.71567893", "0.7086708", "0.70749104", "0.70745933", "0.7067782", "0.7028256", "0.7006761", "0.6972652", "0.69358397", "0.68917364", "0.68821913", "0.68578583", "0.6...
0.0
-1
Build a critic (value) network that maps (state, action) pairs > Qvalues.
def forward(self, state, action): xs = self.fc1(state) x = torch.cat((xs, action), dim=1) return self.fc2(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, mdp, discount=0.9, iterations=100):\n self.mdp = mdp\n self.discount = discount\n self.iterations = iterations\n self.values = util.Counter() # A Counter is a dict with default 0\n self.actions = {}\n\n # iterating over all states and over all possible ...
[ "0.6131123", "0.5916274", "0.5914222", "0.58920246", "0.5792611", "0.5785752", "0.5772253", "0.5719415", "0.5712879", "0.5707243", "0.5700962", "0.5635917", "0.5635139", "0.55866385", "0.55533576", "0.5539992", "0.5538776", "0.553673", "0.5503467", "0.5502352", "0.54854625", ...
0.0
-1
Initialize an Agent object. Params ======
def __init__(self, state_size, action_size, random_seed): self.state_size = state_size self.action_size = action_size self.seed = random.seed(random_seed) # Actor Network (w/ Target Network) self.actor_local = Actor(state_size, action_size, random_seed).to(device) self.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self, parameters, agent_parameters):\n pass", "def agent_init(self):\n pass", "def __init__(self, agent: AEA) -> None:\n self._agent = agent\n super().__init__()", "def __init__(self, agent):\n self.agent = agent", "def __init__(self, env, agent, agent_config, re...
[ "0.79144794", "0.7907644", "0.78940237", "0.7858127", "0.7576287", "0.75161403", "0.73331255", "0.7310851", "0.7076011", "0.7008415", "0.6965792", "0.6952463", "0.69338655", "0.69262373", "0.6922748", "0.6908661", "0.6906984", "0.6862683", "0.6776692", "0.6774649", "0.6766101...
0.0
-1
Save experience in replay memory, and use random sample from buffer to learn.
def step(self, state, action, reward, next_state, done): # Save experience / reward self.memory.add(state, action, reward, next_state, done) # Learn, if enough samples are available in memory if len(self.memory) > BATCH_SIZE: experiences = self.memory.sample() se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def experience_replay(self):\n s,a,r,sp,done = self.memory.sample(self.batch_size)\n # TODO: 5 lines missing.\n raise NotImplementedError(\"\")\n self.Q.fit(s, target=target)", "def learn(self, observation, action, reward, next_observation):\n\n # log transition in replay buffe...
[ "0.74321526", "0.7182348", "0.6886112", "0.67871237", "0.67315227", "0.6636601", "0.66350985", "0.6614109", "0.654479", "0.64978814", "0.64533705", "0.63893026", "0.63325363", "0.6220898", "0.6161728", "0.6121152", "0.61211336", "0.6089247", "0.60032904", "0.6002333", "0.5994...
0.5787425
45
Returns actions for given state as per current policy.
def act(self, state, add_noise=True): state = torch.from_numpy(state).float().to(device) self.actor_local.eval() with torch.no_grad(): action = self.actor_local(state).cpu().data.numpy() self.actor_local.train() if add_noise: action += self.noise.sample() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getActions(self, state): \n util.raiseNotDefined()", "def get_available_actions(self, state):\n pass", "def getLegalActions(self, state):\n return self.actionFn(state)", "def getLegalActions(self,state):\n return self.actionFn(state)", "def get_actions(self, state: TState...
[ "0.81838465", "0.78749645", "0.77763903", "0.7757848", "0.73765945", "0.7321794", "0.7245651", "0.72075933", "0.7111871", "0.7106728", "0.7075502", "0.70645916", "0.7050402", "0.7008547", "0.70066535", "0.69912755", "0.69878536", "0.6983712", "0.6970548", "0.6949809", "0.6895...
0.0
-1
Initialize an Agent object. Params ======
def __init__(self, state_size, action_size, num_agents, random_seed): self.state_size = state_size self.action_size = action_size self.seed = random.seed(random_seed) self.num_agents = num_agents # Actor Network (w/ Target Network) self.actor_local = [Actor(state_size, a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self, parameters, agent_parameters):\n pass", "def agent_init(self):\n pass", "def __init__(self, agent: AEA) -> None:\n self._agent = agent\n super().__init__()", "def __init__(self, agent):\n self.agent = agent", "def __init__(self, env, agent, agent_config, re...
[ "0.79144794", "0.7907644", "0.78940237", "0.7858127", "0.7576287", "0.75161403", "0.73331255", "0.7310851", "0.7076011", "0.7008415", "0.6965792", "0.6952463", "0.69338655", "0.69262373", "0.6922748", "0.6908661", "0.6906984", "0.6862683", "0.6776692", "0.6774649", "0.6766101...
0.0
-1
Save experience in replay memory, and use random sample from buffer to learn.
def step(self, states, actions, rewards, next_states, dones): # Save experience / reward for state, action, reward, next_state, done in zip(states, actions, rewards, next_states, dones): self.memory.add(state, action, reward, next_state, done) # Learn, if enough samples are availabl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def experience_replay(self):\n s,a,r,sp,done = self.memory.sample(self.batch_size)\n # TODO: 5 lines missing.\n raise NotImplementedError(\"\")\n self.Q.fit(s, target=target)", "def learn(self, observation, action, reward, next_observation):\n\n # log transition in replay buffe...
[ "0.7433034", "0.7182474", "0.6887168", "0.67872477", "0.6732001", "0.66373146", "0.6634795", "0.6615569", "0.6545275", "0.64977324", "0.64536935", "0.638845", "0.63325757", "0.62210405", "0.6161313", "0.6121714", "0.6120443", "0.6090666", "0.6004787", "0.6002316", "0.5994054"...
0.0
-1
Initialize parameters and noise process.
def __init__(self, size, seed, mu=0., theta=0.15, sigma=0.2): self.mu = mu * np.ones(size) self.theta = theta self.sigma = sigma self.seed = random.seed(seed) self.reset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noisePreset() :\n s.noisePreset()", "def __init__(self, init_pos, init_stdev, num_particles, sense_noise):\n self.particles = np.random.multivariate_normal(\n init_pos, [[init_stdev**2, 0], [0, init_stdev**2]], num_particles)\n self.weights = np.array(\n [1. / num_parti...
[ "0.7101346", "0.70631665", "0.6602473", "0.6492304", "0.6487118", "0.6473944", "0.6457828", "0.64518017", "0.6436474", "0.64171517", "0.6410189", "0.64020544", "0.63967407", "0.63947", "0.63871187", "0.6379632", "0.6376569", "0.6375367", "0.63648623", "0.636282", "0.6358098",...
0.0
-1
Reset the internal state (= noise) to mean (mu).
def reset(self): self.state = copy.copy(self.mu)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.noise.reset()", "def reset_mean(self,new_mean):\n self.mean = new_mean\n return", "def reset_mean(self,new_mean):\n self.mean = new_mean\n return", "def reset(self):\r\n self.state = copy.copy(self.mu)", "def reset_noise(self):\n self...
[ "0.7501553", "0.7318112", "0.7318112", "0.72231454", "0.70561457", "0.69214433", "0.6806284", "0.6723683", "0.6640285", "0.6487892", "0.6453199", "0.6448848", "0.6381134", "0.6295363", "0.62755775", "0.62719554", "0.62412703", "0.6215498", "0.6210647", "0.6181644", "0.6179889...
0.71814483
12
Update internal state and return it as a noise sample.
def sample(self): x = self.state dx = self.theta * (self.mu - x) + self.sigma * np.array([random.random() for i in range(len(x))]) self.state = x + dx return self.state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noise(self):\r\n if self.buffer_offset + self.frames_per_buffer - 1 > self.x_max:\r\n #relleno con ceros al final si es necesario\r\n xs = np.arange(self.buffer_offset, self.x_max)\r\n tmp = np.random.random_sample(len(xs)) #ruido\r\n out = np.append(tmp, np.z...
[ "0.71401685", "0.7024491", "0.70208496", "0.7018174", "0.7010538", "0.7009448", "0.69488925", "0.69327927", "0.69189125", "0.69058925", "0.6794285", "0.6789316", "0.67037934", "0.65971905", "0.6578757", "0.6578077", "0.6543776", "0.65035415", "0.6503421", "0.6483831", "0.6477...
0.6966576
8
Initialize a ReplayBuffer object. Params ======
def __init__(self, action_size, buffer_size, batch_size, seed): self.action_size = action_size self.memory = deque(maxlen=buffer_size) # internal memory (deque) self.batch_size = batch_size self.experience = namedtuple("Experience", field_names=["state", "action", "reward", "next_state"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_buffers(self) -> None:", "def __init__(self,buffer_size,state_dim,action_dim,random_seed=123):\n print(\"Creating Replay Buffer object\")\n self.buffer_size=buffer_size\n self.state_dim=state_dim\n self.action_dim=action_dim\n self.pointer=0\n self.states...
[ "0.7181454", "0.713491", "0.7095326", "0.7037811", "0.6902241", "0.6832732", "0.6715989", "0.66719276", "0.6636482", "0.6636482", "0.66211057", "0.66046816", "0.6513312", "0.6483003", "0.6372656", "0.62879187", "0.6269024", "0.6256504", "0.62485546", "0.62461096", "0.6237805"...
0.0
-1
Add a new experience to memory.
def add(self, state, action, reward, next_state, done): e = self.experience(state, action, reward, next_state, done) self.memory.append(e)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_experience(self, state, action, reward, next_state, done):\n e = self.experience(state, action, reward, next_state, done, self.max_priority)\n self.memory.append(e)", "def add(self, state, action, reward, next_state, done):\n experience = Experience(state, action, reward, next_st...
[ "0.79568833", "0.79042006", "0.78795445", "0.7577913", "0.7570969", "0.74478436", "0.7361023", "0.72697705", "0.721816", "0.71451885", "0.7106998", "0.7101183", "0.69837016", "0.68905056", "0.68842727", "0.6755663", "0.6712557", "0.6677425", "0.64961654", "0.6488678", "0.6486...
0.71984994
15
Randomly sample a batch of experiences from memory.
def sample(self): experiences = random.sample(self.memory, k=self.batch_size) states = torch.from_numpy(np.vstack([e.state for e in experiences if e is not None])).float().to(device) actions = torch.from_numpy(np.vstack([e.action for e in experiences if e is not None])).float().to(device) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def experience_replay(batch_size):\n memory = []\n while True:\n experience = yield rsample(memory, batch_size) if batch_size <= len(memory) else None\n memory.append(experience)", "def sample(self):\n sample_ind = np.random.choice(len(self.memory), self.batch_size)\n # get the ...
[ "0.766466", "0.7457429", "0.7440625", "0.7404941", "0.7354707", "0.72963357", "0.72740436", "0.7271187", "0.7271187", "0.7262163", "0.7245689", "0.71789676", "0.7083509", "0.7074134", "0.696216", "0.69442594", "0.694124", "0.6940197", "0.68188226", "0.6801462", "0.67985487", ...
0.7283416
6
Return the current size of internal memory.
def __len__(self): return len(self.memory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSize(self) -> int:\n return len(self.mem)", "def getSize(self):\n return self.bf.memory()", "def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024", "def size(self):\n size = 0\n size += self.data.size * sys.getsizeof(self.data)\n return size / ...
[ "0.8573486", "0.8216719", "0.8200263", "0.80869377", "0.80215144", "0.7890612", "0.78215307", "0.7801178", "0.77899903", "0.77588975", "0.77554387", "0.77554387", "0.7755218", "0.775394", "0.773285", "0.77322316", "0.7719518", "0.77139354", "0.7708652", "0.77072173", "0.76973...
0.75126064
55
Utility function systematizing file name convention
def chk_pt_file_name(i_episode,dueling,doubleq): chk_pt_name = 'checkpoint_{0}'.format(i_episode) if dueling: chk_pt_name += '_dueling' if doubleq: chk_pt_name += '_doubleq' chk_pt_name += '.pth' return os.path.join('checkpoints',chk_pt_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fixed_filename(filename):\n new_name = \"\"\n for i, char in enumerate(filename):\n if i + 1 != len(filename):\n previous_character = filename[i - 1]\n next_character = filename[i + 1]\n if char.islower() and next_character.isupper():\n new_name ...
[ "0.76159656", "0.75144535", "0.74587727", "0.735376", "0.73140705", "0.7235197", "0.72076446", "0.7191207", "0.71763813", "0.7174404", "0.7150744", "0.71171355", "0.71063554", "0.71063554", "0.71063554", "0.71026623", "0.70655054", "0.7064385", "0.7057215", "0.7016418", "0.69...
0.0
-1
Query the database for a link on the current record. If found, update the existing link, if not, insert new row
def updateOrInsert(cls, session, link, model, recordID): outLink = Link.lookupLink(session, link, model, recordID) if outLink is None: outLink = Link(**link) else: outLink.update(link) return outLink
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_link_into_external_link(link, found_date, anchor, link_type):\r\n db = connect()\r\n cursor = db.cursor()\r\n print \"------------------------------------------------------------------------------\"\r\n print \"link:\",link\r\n print \"link:\",found_date\r\n #print \"link:\",str(anchor...
[ "0.623239", "0.6042356", "0.60063356", "0.591801", "0.5868072", "0.58506054", "0.5849309", "0.5798199", "0.5755617", "0.5753384", "0.573804", "0.5720427", "0.56632406", "0.5543761", "0.55327636", "0.55120534", "0.5490153", "0.54851514", "0.5463551", "0.5451651", "0.5436525", ...
0.7612958
0
Update fields on existing link
def update(self, linkData): for field, value in linkData.items(): if field == 'flags': setattr(self, field, value) elif(value is not None and value.strip() != ''): setattr(self, field, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relink(self, link_id):", "def put(self):\n if jwthandler.authorize_action(self, 1) == False:\n return None\n\n userdata = jwthandler.decode_userdata(self.request.headers[\"Authorization\"])\n\n body_categories = {\"link_id\": 1, \"view_id\": 0, \"node_id_1\": 0, \"node_id_2\":...
[ "0.68344724", "0.66124517", "0.660164", "0.65914994", "0.6363283", "0.63509566", "0.63125825", "0.6273736", "0.61451024", "0.61311626", "0.61165154", "0.6072572", "0.60497147", "0.60104465", "0.60076165", "0.5906549", "0.5847444", "0.5844992", "0.5826938", "0.58229995", "0.58...
0.68995327
0
Query database for link related to current record. Return link if found, otherwise return None
def lookupLink(cls, session, link, model, recordID): checkURL = Link.httpRegexSub(link.get('url', None)) return session.query(cls)\ .join(model.__tablename__)\ .filter(model.id == recordID)\ .filter(cls.url == checkURL)\ .one_or_none()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _link_for_query(self, query):\r\n results = list(query)\r\n return results[0] if results else None", "def link(self) -> Optional[str]:\n return pulumi.get(self, \"link\")", "def link(self) -> Optional[str]:\n return pulumi.get(self, \"link\")", "def _get_self_record(self, record: ...
[ "0.6749376", "0.6332646", "0.6332646", "0.62515604", "0.61730146", "0.61730146", "0.61730146", "0.6066266", "0.60131997", "0.5963378", "0.5962121", "0.5958353", "0.59456277", "0.589322", "0.5848187", "0.58002985", "0.5758175", "0.5740583", "0.5740583", "0.5739168", "0.5739168...
0.71646607
0
Create a new cell from a Cell protobuf.
def from_pb(cls, cell_pb): timestamp = _datetime_from_microseconds(cell_pb.timestamp_micros) if cell_pb.labels: return cls(cell_pb.value, timestamp, labels=cell_pb.labels) else: return cls(cell_pb.value, timestamp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cell(self, cid):\n self.cells[cid] = Cell()", "def reproduce(self, id, position, partner):\n return Cell(id, position, self, partner)", "def _create_cell(self,row_number,cell_number):\n cell = Cell(self)\n cell.x = cell_number * self.cell_width\n cell.y = row_numbe...
[ "0.6069733", "0.59923977", "0.591453", "0.5743067", "0.57002413", "0.5664882", "0.56352407", "0.56330913", "0.5609407", "0.5444072", "0.54251987", "0.5407165", "0.53757244", "0.53634584", "0.5359123", "0.53427815", "0.534006", "0.5338059", "0.5290304", "0.52515936", "0.525070...
0.7500258
0
Append bytes from a new chunk to value.
def append_value(self, value): self.value += value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_bytes(self, data):\n\n if self.index != 7:\n self.buf.append(self.byte)\n self.byte = 0\n self.index = 7\n\n self.buf.extend(data)", "def add_chunk(self, chunk):\n self.chunkbuffer.appendleft(chunk)", "def add_byte(self, newbyte):\n self._...
[ "0.6965538", "0.6886509", "0.6466157", "0.6369547", "0.63468874", "0.63018787", "0.61934674", "0.6191349", "0.61861724", "0.6181847", "0.6159716", "0.61312646", "0.6124018", "0.6061957", "0.5985089", "0.5908056", "0.5903064", "0.58985186", "0.58978224", "0.58650523", "0.58631...
0.63629705
4
Convert the cells to a dictionary. This is intended to be used with HappyBase, so the column family and
def to_dict(self): result = {} for column_family_id, columns in six.iteritems(self._cells): for column_qual, cells in six.iteritems(columns): key = (_to_bytes(column_family_id) + b':' + _to_bytes(column_qual)) result[key] = cells ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dict(self) -> Dict[str, Any]:\n return {\n column_title: cell.get_value()\n for column_title, cell in self.column_title_to_cell.items()\n }", "def as_dict(self) -> Dict[str, Any]:\n return {\n column_title: cell.value\n for column_title, cel...
[ "0.76013017", "0.75878423", "0.71978664", "0.69413537", "0.66823757", "0.6574558", "0.643032", "0.64155895", "0.6379977", "0.6318955", "0.6313105", "0.6252503", "0.6244445", "0.62411374", "0.61758727", "0.61758727", "0.61758727", "0.61758727", "0.61758727", "0.61635846", "0.6...
0.79329205
0
Property returning all the cells accumulated on this partial row.
def cells(self): return copy.deepcopy(self._cells)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cells_total(self):\n return self._inv.get(\"cells\", len(self))", "def get_total_cells(self):\n return self._get(\"cells\")", "def cells(self):\n return self.container['cells']", "def cells(self):\n return chain.from_iterable(self.cols)", "def cells(self):\r\n return ...
[ "0.7329604", "0.72963184", "0.7285541", "0.71675426", "0.70034677", "0.6740002", "0.6697525", "0.6685098", "0.6658701", "0.66584843", "0.653525", "0.6513235", "0.6502038", "0.6449473", "0.6402963", "0.63210136", "0.62875944", "0.6282429", "0.6233849", "0.61757165", "0.6172168...
0.69514596
5
Getter for the current (partial) row's key.
def row_key(self): return self._row_key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __key__(self) -> Tuple[int, int]:\n return self.col, self.row", "def get_key(self) -> int:\n return self.__key", "def get_key(self) -> int:\n return self.key", "def get_key(self):\n return self.key", "def get_key(self):\n return self.key", "def key(self):\n r...
[ "0.72316724", "0.72159064", "0.7207303", "0.7157399", "0.7157399", "0.71138483", "0.7061789", "0.7047705", "0.6999932", "0.6988818", "0.6988818", "0.6988818", "0.6988818", "0.6960423", "0.6876054", "0.683839", "0.68287086", "0.6781018", "0.6758112", "0.67410135", "0.6730147",...
0.84983855
0
Property returning all rows accumulated from the stream.
def rows(self): # NOTE: To avoid duplicating large objects, this is just the # mutable private data. return self._rows
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def fetchall(self):\n\n self._check_executed()\n\n if self._query_id == -1:\n msg = \"query didn't result in a resultset\"\n self._exception_handler(ProgrammingError, msg)\n\n result = self._rows[self.rownumber - self._offset :]\n self.rownumber = len(self._r...
[ "0.6823442", "0.64770746", "0.63634026", "0.62843436", "0.6277957", "0.62755823", "0.6224927", "0.6217208", "0.61437726", "0.61001796", "0.6064008", "0.60063374", "0.5994555", "0.5987653", "0.59443873", "0.5943947", "0.59357786", "0.5925868", "0.5912474", "0.58995414", "0.589...
0.6456861
2
Cancels the iterator, closing the stream.
def cancel(self): self._response_iterator.cancel()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if callable(getattr(self._file, 'close', None)):\n self._iterator.close()\n self._iterator = None\n self._unconsumed = None\n self.closed = True", "def close(self):\n if self.closed:\n return\n self._stream.close()\n self._stream = None", ...
[ "0.67333686", "0.63217324", "0.6200361", "0.6189285", "0.60646605", "0.5990257", "0.59821737", "0.5979769", "0.5914633", "0.58941954", "0.58596677", "0.58370185", "0.5811813", "0.5810032", "0.5777921", "0.5777921", "0.57457614", "0.57253283", "0.5688793", "0.56884354", "0.568...
0.67483526
0
Consume the next ``ReadRowsResponse`` from the stream. Parse the response and its chunks into a new/existing row in
def consume_next(self): response = six.next(self._response_iterator) self._counter += 1 if self._last_scanned_row_key is None: # first response if response.last_scanned_row_key: raise InvalidReadRowsResponse() self._last_scanned_row_key = response.last_scan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _receive_response_body(\n self, request: Request, stream_id: int\n ) -> typing.AsyncIterator[bytes]:\n while True:\n event = await self._receive_stream_event(request, stream_id)\n if isinstance(event, h2.events.DataReceived):\n amount = event.flow_con...
[ "0.61128515", "0.6106053", "0.5749937", "0.5664724", "0.562037", "0.5559969", "0.55483514", "0.55231017", "0.551602", "0.551602", "0.5493233", "0.54856974", "0.5481049", "0.54711795", "0.5399032", "0.53882605", "0.5361007", "0.53610015", "0.53456414", "0.5320742", "0.52846736...
0.80644053
0