def __init__(self, addr_list, precision=100): if not isinstance(addr_list, list): raise AttributeError self._servers = [] self._servers = [Server(address) for address in addr_list] self._servIndex = 0 self._precision = precision self.ray_map_marks = Marks() self.hits = dict() # point coords and distance to nearest grid node self.grid = dict() self.hit_dirs = set() self.jobDone = False self.doneCount = 0 self.raysCount = 0 self.timeDelta = 0 # populate directions tree self._directionTree = { (-1, 0, 0): 0, (1, 0, 0): 1, (0, -1, 0): 2, (0, 1, 0): 3, (0, 0, -1): 4, (0, 0, 1): 5 } #debug self.min = precision self._hitFile = open("hits.data", "wb")
def mark_y(self, y, i=0, **kwargs): if i == 0: i = len(self.plots) - 1 self.add_opts('marks_%s' % i, Marks().mark_y(y, **kwargs)) return self
def axis_zero(self, **kwargs): """Activates line that marks the axis X at Y = 0""" self.add_opts('axis_zero', Marks().hline(0, **kwargs)) return self
def fill(self, **kwargs): """Sets up to all the plots be filled.""" self.add_opts('marks', Marks().fill(**kwargs)) return self
def mark_line_x(self, x, **kwargs): self.add_opts('marks', Marks().vline(x, **kwargs)) return self
def mark_line_y(self, y, **kwargs): self.add_opts('marks', Marks().hline(y, **kwargs)) return self
def studentClicked(self, studentName, courseName) -> None: ''' Loads the page of a specific student Displays the student's assignments, assignment weightings and marks in the specified course Parameters ---------- studentName : str Name of the student courseName : str Name of the course Returns ------- ZeroDivisionError If there are no assignments with categories (with >0 weighting) assigned more than 0 marks KeyError If the document in 'GradebookCourses' does not have an 'assignments' key ZeroDivisionError If there is no instance of the assignment in the student's document (mark of 0 is divided by a weighting of 0) IndexError If index used on markObj.assignmentMarks is out of range KeyError If dict in markObj.assignmentList does not have an 'adjusted weighting' key ''' self.clearBottomFrame() self.title(studentName) self.studentManageBtn.destroy() self.assignmentManageBtn.destroy() self.courseManageBtn.config( text='Return to ' + courseName, command=lambda: self.courseClicked(courseName)) markObj = Marks(self.currentAccount, courseName, studentName) markObj.defaultSort() Label(self.bottomFrame, text='Default Mark(%)').grid(row=0, column=1, sticky=EW) Label(self.bottomFrame, text='Adjusted Mark(%)').grid(row=0, column=2, sticky=EW) Label(self.bottomFrame, text='Total Mark', font=('Helvetica', 40)).grid(row=1, column=0, sticky='EW') try: Label(self.bottomFrame, text=str(round(markObj.totalMark(), 2)), font=('Helvetica', 40)).grid(row=1, column=1, sticky='EW') Label(self.bottomFrame, text=str(round(markObj.totalMarkAdjusted(), 2)), font=('Helvetica', 40)).grid(row=1, column=2, sticky='EW') except Exception as e: #print (e) Label(self.bottomFrame, text='N/A', font=('Helvetica', 40)).grid(row=1, column=1, sticky='EW') Label(self.bottomFrame, text='N/A', font=('Helvetica', 40)).grid(row=1, column=2, sticky='EW') Label(self.bottomFrame, text='Assignments').grid(row=2, column=0, sticky=EW) Label(self.bottomFrame, text='Effective Weighting').grid(row=2, column=1, sticky=EW) Label(self.bottomFrame, text='Mark(%)').grid(row=2, column=2, sticky=EW) row = 3 minIndex = 0 try: for x in sorted(Courses(self.currentAccount).docGet( {'course name': courseName}, 'GradebookCourses')["assignments"], key=lambda y: y['assignment name'].lower()): try: Button(self.bottomFrame, text=x['assignment name'], font=('Helvetica', 40), command=lambda y=x: self.assignmentClicked( y['assignment name'], courseName, 'Student', studentName, markObj)).grid(row=row, column=0, sticky='EW') if markObj.assignmentList[minIndex].assignmentMarks[ 'assignment name'] == x['assignment name']: Label(self.bottomFrame, text=str( round( markObj.assignmentList[minIndex]. calculate()[0], 2)), font=('Helvetica', 40)).grid(row=row, column=2, sticky='EW') try: Label( self.bottomFrame, text=str( round( markObj.assignmentList[minIndex]. assignmentMarks['adjusted weighting'], 2)), font=('Helvetica', 40)).grid(row=row, column=1, sticky='EW') except: Label(self.bottomFrame, text=str(round(x['weighting'], 2)), font=('Helvetica', 40)).grid(row=row, column=1, sticky='EW') minIndex += 1 else: Label(self.bottomFrame, text='N/A', font=('Helvetica', 40)).grid(row=row, column=2, sticky='EW') Label(self.bottomFrame, text='0', font=('Helvetica', 40)).grid(row=row, column=1, sticky='EW') except ZeroDivisionError as e: #print(e) Label(self.bottomFrame, text='N/A', font=('Helvetica', 40)).grid(row=row, column=2, sticky='EW') Label(self.bottomFrame, text='0', font=('Helvetica', 40)).grid(row=row, column=1, sticky='EW') minIndex += 1 except IndexError as e: #print(e) Label(self.bottomFrame, text='N/A', font=('Helvetica', 40)).grid(row=row, column=2, sticky='EW') Label(self.bottomFrame, text='0', font=('Helvetica', 40)).grid(row=row, column=1, sticky='EW') row += 1 except: pass
#this script brings joy from classGreeting import Greeting from marks import Marks M = Marks() gr = Greeting() print("\n{0}, {1}!\n{2}".format(gr.grtng(), gr.getName(), gr.compliment())) print( "Теперь поможем вычислить количество баллов, которые Вы поставите нам за данную работу :)" ) m1 = M.getGeneralMark() m2 = M.getAddMark1() m3 = M.getAddMark2() m4 = M.getAddMark3() print("Итоговое количество баллов = {0}".format(m1 + m2 + m3 + m4))