function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def recoverIntComment(self, comment): self.addIntComment(comment) comment.recover()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def unMarkAsDuplicated(self,responsible,comments="", track=None, answers=[]): """ """ #we must clear any track judgement self._clearTrackAcceptances() self._clearTrackRejections() self._clearTrackReallocations() #self.getCurrentStatus().recover() #status change self.getCurrentStatus().unMarkAsDuplicated(responsible,comments) # check if there is a previous judgement of this author in for this abstract in this track self._removePreviousJud(responsible, track) if track is not None: jud = AbstractUnMarkedAsDuplicated(self, track, responsible, answers) jud.setComment( comments ) self._addTrackJudgementToHistorical(jud) else: for t in self.getTrackList(): jud = AbstractUnMarkedAsDuplicated(self, t, responsible, answers ) jud.setComment( comments ) self._addTrackJudgementToHistorical(jud) # Update the rating of the abstract self.updateRating() self._notifyModification()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def notify(self,notificator,responsible): """notifies the abstract responsibles with a matching template """ tpl=self.getOwner().getNotifTplForAbstract(self) if not tpl: return notificator.notify(self,tpl) self.getNotificationLog().addEntry(NotifLogEntry(responsible,tpl))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getNotificationLog(self): try: if self._notifLog: pass except AttributeError: self._notifLog=NotificationLog(self) return self._notifLog
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getRating(self): """ Get the average rating of the abstract """ try: if self._rating: pass except AttributeError: self._rating = None return self._rating
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getQuestionsAverage(self): '''Get the list of questions answered in the reviews for an abstract ''' dTotals = {} # {idQ1: total_value, idQ2: total_value ...} dTimes = {} # {idQ1: times_answered, idQ2: times_answered} for track in self.getTrackListSorted(): for jud in self.getJudgementHistoryByTrack(track): for answer in jud.getAnswers(): # check if the question is in d and sum the answers value or insert in d the new question if dTotals.has_key(answer.getQuestion().getText()): dTotals[answer.getQuestion().getText()] += answer.getValue() dTimes[answer.getQuestion().getText()] += 1 else: # first time dTotals[answer.getQuestion().getText()] = answer.getValue() dTimes[answer.getQuestion().getText()] = 1 # get the questions average questionsAverage = {} for q, v in dTotals.iteritems(): # insert the element and calculate the average for the value questionsAverage[q] = float(v)/dTimes[q] return questionsAverage
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getRatingPerReviewer(self, user, track): """ Get the rating of the user for the abstract in the track given. """ for jud in self.getJudgementHistoryByTrack(track): if (jud.getResponsible() == user): return jud.getJudValue()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _getAttachmentsCounter(self): try: if self._attachmentsCounter: pass except AttributeError: self._attachmentsCounter = Counter() return self._attachmentsCounter.newCount()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getAttachments(self): try: if self._attachments: pass except AttributeError: self._attachments = {} return self._attachments
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__( self, abstract, track, responsible, answers ): self._abstract = abstract self._track = track self._setResponsible( responsible ) self._comment = "" self._date = nowutc() self._answers = answers self._judValue = self.calculateJudgementAverage() # judgement average value self._totalJudValue = self.calculateAnswersTotalValue()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getResponsible( self ): return self._responsible
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def setDate(self, date): self._date = date
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def setComment( self, newComment ): self._comment = newComment.strip()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getAnswers(self): try: if self._answers: pass except AttributeError: self._answers = [] return self._answers
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getJudValue(self): try: if self._judValue: pass except AttributeError: self._judValue = self.calculateJudgementAverage() # judgement average value return self._judValue
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def calculateAnswersTotalValue(self): ''' Calculate the sum of all the ratings ''' result = 0 for ans in self.getAnswers(): result += ans.getValue() return result
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def removeAnswer(self, questionId): ''' Remove the current answers of the questionId ''' for ans in self.getAnswers(): if ans.getQuestion().getId() == questionId: self._answers.remove(ans) self._notifyModification()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__(self, abstract, track, responsible, contribType, answers): AbstractJudgement.__init__(self, abstract, track, responsible, answers) self._contribType = contribType
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def setDate(self, date): self.as_new.creation_dt = date
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def clone(self, track): arj = AbstractRejection(self._abstract, track, self.getResponsible(), self.getAnswers()) return arj
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__(self, abstract, track, responsible, propTracks, answers): AbstractJudgement.__init__(self, abstract, track, responsible, answers) self._proposedTracks = PersistentList( propTracks )
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getProposedTrackList( self ): return self._proposedTracks
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__(self, abstract, track): AbstractJudgement.__init__(self, abstract, track, None, '')
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__(self, abstract, track, responsible, originalAbst, answers): AbstractJudgement.__init__(self, abstract, track, responsible, answers) self._originalAbst = originalAbst
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getOriginalAbstract(self): return self._originalAbst
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def clone(self, track): auad = AbstractUnMarkedAsDuplicated(self._abstract, track,self.getResponsible()) return auad
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__( self, abstract ): self._setAbstract( abstract ) self._setDate( nowutc() )
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setAbstract( self, abs ): self._abstract = abs
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setDate( self, date ): self._date = date
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def accept(self, responsible, destTrack, type_, comments=""): """ """ abstract = self.getAbstract() s = AbstractStatusAccepted(abstract, responsible, comments) abstract.as_new.accepted_track_id = destTrack.id if destTrack else None abstract.as_new.accepted_type = type_ self.getAbstract().setCurrentStatus(s)
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _getStatusClass( self ): """ """ numAccepts = self._abstract.getNumProposedToAccept() # number of tracks that have at least one proposal to accept numReallocate = self._abstract.getNumProposedToReallocate() # number of tracks that have at least one proposal to reallocate numJudgements = self._abstract.getNumJudgements() # number of tracks that have at least one judgement if numJudgements > 0: # If at least one track status is in conflict the abstract status is in conflict too. if any(isinstance(self._abstract.getTrackJudgement(track), AbstractInConflict) for track in self._abstract.getTrackList()): return AbstractStatusInConflict numTracks = self._abstract.getNumTracks() # number of tracks that this abstract has assigned if numTracks == numJudgements: # Do we have judgements for all tracks? if numReallocate == numTracks: return AbstractStatusInConflict elif numAccepts == 1: return AbstractStatusProposedToAccept elif numAccepts == 0: return AbstractStatusProposedToReject return AbstractStatusInConflict return AbstractStatusUnderReview return AbstractStatusSubmitted
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToAccept( self ): """ """ s = self._getStatusClass()( self._abstract ) self.getAbstract().setCurrentStatus( s )
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToReallocate( self ): """ """ s = self._getStatusClass()( self._abstract ) self.getAbstract().setCurrentStatus( s )
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def recover( self ): """ """ raise MaKaCError( _("only withdrawn abstracts can be recovered"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def unMarkAsDuplicated(self,responsible,comments=""): """ """ raise MaKaCError( _("Only duplicated abstract can be unmark as duplicated"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def unMerge(self,responsible,comments=""): """ """ raise MaKaCError( _("Only merged abstracts can be unmerged"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def clone(self,abstract): ass = AbstractStatusSubmitted(abstract) return ass
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__(self, abstract, responsible, comments=""): AbstractStatus.__init__(self, abstract) self._setResponsible(responsible) self._setComments(comments)
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setResponsible( self, res ): self._responsible = res
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setComments( self, comments ): self._comments = str( comments ).strip()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def update( self ): return
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def reject( self, responsible, comments="" ): raise MaKaCError( _("Cannot reject an abstract which is already accepted"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToReject( self ): raise MaKaCError( _("Cannot propose for rejection an abstract which is already accepted"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def markAsDuplicated(self,responsible,originalAbs,comments=""): raise MaKaCError( _("Cannot mark as duplicated an abstract which is accepted"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def mergeInto(self,responsible,targetAbs,comments=""): raise MaKaCError( _("Cannot merge an abstract which is already accepted"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__( self, abstract, responsible, comments = "" ): AbstractStatus.__init__( self, abstract ) self._setResponsible( responsible ) self._setComments( comments )
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setResponsible( self, res ): self._responsible = res
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setComments( self, comments ): self._comments = str( comments ).strip()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def update( self ): return
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToAccept( self ): raise MaKaCError( _("Cannot propose for acceptance an abstract which is already rejected"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToReallocate( self ): raise MaKaCError( _("Cannot propose for reallocation an abstract which is already rejected"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def markAsDuplicated(self,responsible,originalAbs,comments=""): raise MaKaCError( _("Cannot mark as duplicated an abstract which is rejected"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def mergeInto(self,responsible,targetAbs,comments=""): raise MaKaCError( _("Cannot merge an abstract which is rejected"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def clone(self,abstract): asur = AbstractStatusUnderReview(abstract) return asur
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def clone(self, abstract): aspta = AbstractStatusProposedToAccept(abstract) return aspta
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getType(self): jud=self.getAbstract().getTrackAcceptanceList()[0] return jud.getContribType()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def clone(self, abstract): asptr = AbstractStatusProposedToReject(abstract) return asptr
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def clone(self,abstract): asic = AbstractStatusInConflict(abstract) return asic
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__(self,abstract,responsible, prevStatus,comments=""): AbstractStatus.__init__(self,abstract) self._setComments(comments) self._setResponsible(responsible) self._prevStatus=prevStatus
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setResponsible(self,newResp): self._responsible=newResp
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getPrevStatus(self): try: if self._prevStatus: pass except AttributeError,e: self._prevStatus=None return self._prevStatus
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getComments( self ): return self._comments
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def accept(self,responsible,destTrack,type,comments=""): raise MaKaCError( _("Cannot accept an abstract wich is withdrawn"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToAccept( self ): raise MaKaCError( _("Cannot propose for acceptance an abstract which withdrawn"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def recover(self): abstract = self.getAbstract() contrib = abstract.as_new.contribution if self.getPrevStatus() is None: # reset all the judgments self._clearTrackAcceptances() self._clearTrackRejections() self._clearTrackReallocations() # setting the status if contrib is None: s = AbstractStatusSubmitted(abstract) else: s = AbstractStatusAccepted(abstract, self.getResponsible(), "") else: if contrib is not None and not isinstance(self.getPrevStatus(), AbstractStatusAccepted): s = AbstractStatusAccepted(abstract, self.getResponsible(), "") else: s = self.getPrevStatus() abstract.setCurrentStatus(s) abstract.as_new.accepted_track_id = int(contrib.track.id) if contrib.track else None abstract.as_new.accepted_type = contrib.type
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def unMarkAsDuplicated(self,responsible,comments=""): """ """ raise MaKaCError( _("Only duplicated abstract can be unmark as duplicated"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def withdraw(self,resp,comments=""): raise MaKaCError( _("This abstract is already withdrawn"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__( self,abstract,responsible,originalAbstract,comments=""): AbstractStatus.__init__(self,abstract) self._setResponsible(responsible) self._setComments(comments) self._setOriginalAbstract(originalAbstract)
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setResponsible( self, res ): self._responsible = res
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setComments( self, comments ): self._comments = str( comments ).strip()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setOriginalAbstract(self,abs): self._original=abs
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def update( self ): return
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToAccept( self ): raise MaKaCError( _("Cannot propose for acceptance an abstract which is duplicated"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToReallocate( self ): raise MaKaCError( _("Cannot propose for reallocation an abstract which is duplicated"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def markAsDuplicated(self,responsible,originalAbs,comments=""): raise MaKaCError( _("This abstract is already duplicated"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def mergeInto(self,responsible,targetAbs,comments=""): raise MaKaCError( _("Cannot merge an abstract which is marked as a duplicate"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__(self,abstract,responsible,targetAbstract,comments=""): AbstractStatus.__init__(self,abstract) self._setResponsible(responsible) self._setComments(comments) self._setTargetAbstract(targetAbstract)
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setResponsible( self, res ): self._responsible = res
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setComments( self, comments ): self._comments = str( comments ).strip()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def _setTargetAbstract(self,abstract): self._target=abstract
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def update( self ): return
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToAccept( self ): raise MaKaCError( _("Cannot propose for acceptance an abstract which is merged into another one"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def proposeToReallocate( self ): raise MaKaCError( _("Cannot propose for reallocation an abstract which is merged into another one"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def markAsDuplicated(self,responsible,originalAbs,comments=""): raise MaKaCError( _("Cannot mark as duplicated an abstract which is merged into another one"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def mergeInto(self,responsible,target,comments=""): raise MaKaCError( _("This abstract is already merged into another one"))
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__(self,abstract): AbstractStatus.__init__(self,abstract)
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def __init__(self): self._owner=None self._id="" self._name="" self._description="" self._tplSubject="" self._tplBody="" self._fromAddr = "" self._CAasCCAddr = False self._ccAddrList=PersistentList() self._toAddrs = PersistentList() self._conditions=PersistentList() self._toAddrGenerator=Counter() self._condGenerator=Counter()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def delete(self): self.clearToAddrs() self.clearCCAddrList() self.clearConditionList() TrashCanManager().add(self)
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def canModify(self, aw_or_user): return self.getConference().canModify(aw_or_user)
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getConference(self): return self._owner.getConference()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getOwner(self): return self._owner
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def setName(self,newName): self._name=newName.strip()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def setDescription(self,newDesc): self._description=newDesc.strip()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def setTplSubject(self,newSubject, varList): self._tplSubject=self.parseTplContent(newSubject, varList).strip()
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getTplSubjectShow(self, varList): return self.parseTplContentUndo(self._tplSubject, varList)
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getTplBody(self): return self._tplBody
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getCCAddrList(self): try: if self._ccAddrList: pass except AttributeError: self._ccAddrList=PersistentList() return self._ccAddrList
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def setCCAddrList(self,l): self.clearCCAddrList() for addr in l: self.addCCAddr(addr)
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getCAasCCAddr(self): try: if self._CAasCCAddr: pass except AttributeError: self._CAasCCAddr = False return self._CAasCCAddr
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]
def getFromAddr(self): try: return self._fromAddr except AttributeError: self._fromAddr = self._owner.getConference().getSupportInfo().getEmail() return self._fromAddr
belokop/indico_bare
[ 1, 1, 1, 5, 1465204236 ]