This is a snapshot of Indico's old Trac site. Any information contained herein is most probably outdated. Access our new GitHub site here.

Ticket #1076: 0001-REF-Do-not-use-derepcated-sets.Set.patch

File 0001-REF-Do-not-use-derepcated-sets.Set.patch, 9.8 KB (added by pedersen, 3 years ago)
  • bin/recovery/backup.py

    From 2f121a28af4305a81caa350d6f296e91df2e94a7 Mon Sep 17 00:00:00 2001
    From: Bjoern Pedersen <bjoern.pedersen@frm2.tum.de>
    Date: Mon, 20 Aug 2012 15:23:26 +0200
    Subject: [PATCH] [REF] Do not use derepcated sets.Set
    
     * change from deprecated sets.Set to set.
    ---
     bin/recovery/backup.py                          |  5 ++---
     indico/MaKaC/booking.py                         |  1 -
     indico/MaKaC/webinterface/pages/conferences.py  |  5 ++---
     indico/MaKaC/webinterface/rh/conferenceModif.py |  7 +++----
     indico/MaKaC/webinterface/rh/sessionModif.py    |  7 +++----
     indico/MaKaC/webinterface/rh/trackModif.py      |  7 +++----
     indico/MaKaC/webinterface/timetable.py          | 11 +++++------
     indico/htdocs/scripts/Forthcoming.py            |  7 +++----
     indico/htdocs/scripts/SSLPdisplay.py            |  2 +-
     indico/htdocs/scripts/createCategoryHeader.py   |  2 +-
     indico/tests/runners.py                         |  3 +--
     11 Dateien geÀndert, 24 Zeilen hinzugefÌgt(+), 33 Zeilen entfernt(-)
    
    diff --git a/bin/recovery/backup.py b/bin/recovery/backup.py
    index 4a61093..1077047 100644
    a b import os 
    2222import sys 
    2323## TO BE CHANGED: 
    2424#sys.path.append('C:/Documents and Settings/smilenko/My Documents/project/indico/code/code') 
    25 import sets 
    2625from distutils import sysconfig 
    2726from datetime import datetime 
    2827from MaKaC.common import Config 
    python = os.path.join(sysconfig.get_config_vars()["exec_prefix"], "python") 
    4140repozo = "C:/Python23/Scripts/repozo.py" 
    4241 
    4342def main(): 
    44     tmp = sets.Set(os.listdir(backupsPath)) 
     43    tmp = set(os.listdir(backupsPath)) 
    4544    name = datetime.utcnow().strftime("%Y-%m-%d-%H-%M-%S") 
    4645    os.system("%s %s %s %s %s %s %s %s %s"%(python, repozo, "-B", "-f",\ 
    4746    "\"%s\""%os.path.join(currentPath, dataFile), "-F", "-z", "-r",\ 
    4847    "\"%s\""%backupsPath)) 
    49     names = sets.Set(os.listdir(backupsPath)) 
     48    names = set(os.listdir(backupsPath)) 
    5049    names.difference_update(tmp) 
    5150    for n in names: 
    5251        os.rename(os.path.join(backupsPath, n), os.path.join(backupsPath,\ 
  • indico/MaKaC/booking.py

    diff --git a/indico/MaKaC/booking.py b/indico/MaKaC/booking.py
    index f4d342c..ce1be9b 100644
    a b  
    2121import os 
    2222import re 
    2323import tempfile 
    24 import sets 
    2524import os.path 
    2625import copy 
    2726from pytz import timezone 
  • indico/MaKaC/webinterface/pages/conferences.py

    diff --git a/indico/MaKaC/webinterface/pages/conferences.py b/indico/MaKaC/webinterface/pages/conferences.py
    index 6938df5..7106855 100644
    a b class WConfMyStuffMySessions(wcomponents.WTemplated): 
    75837583        if self._aw.getUser() is None: 
    75847584            return "" 
    75857585        #ls=self._conf.getCoordinatedSessions(self._aw.getUser())+self._conf.getManagedSession(self._aw.getUser()) 
    7586         from sets import Set 
    7587         ls = Set(self._conf.getCoordinatedSessions(self._aw.getUser())) 
    7588         ls = list(ls | Set(self._conf.getManagedSession(self._aw.getUser()))) 
     7586        ls = set(self._conf.getCoordinatedSessions(self._aw.getUser())) 
     7587        ls = list(ls | set(self._conf.getManagedSession(self._aw.getUser()))) 
    75897588        if len(ls)<=0: 
    75907589            return "" 
    75917590        res=[] 
  • indico/MaKaC/webinterface/rh/conferenceModif.py

    diff --git a/indico/MaKaC/webinterface/rh/conferenceModif.py b/indico/MaKaC/webinterface/rh/conferenceModif.py
    index 7f8f228..ee62237 100644
    a b from pytz import timezone 
    2929import MaKaC.webinterface.common.timezones as convertTime 
    3030import MaKaC.common.timezoneUtils as timezoneUtils 
    3131from BTrees.OOBTree import OOBTree 
    32 from sets import Set 
    3332from MaKaC.webinterface.common.abstractDataWrapper import AbstractParam 
    3433import MaKaC.review as review 
    3534import MaKaC.webinterface.urlHandlers as urlHandlers 
    class RHAbstractsParticipantList(RHConfModifCFABase): 
    51135112        submitters = OOBTree() 
    51145113        primaryAuthors = OOBTree() 
    51155114        coAuthors = OOBTree() 
    5116         submitterEmails = Set() 
    5117         primaryAuthorEmails = Set() 
    5118         coAuthorEmails = Set() 
     5115        submitterEmails = set() 
     5116        primaryAuthorEmails = set() 
     5117        coAuthorEmails = set() 
    51195118 
    51205119        self._setGroupsToDisplay() 
    51215120 
  • indico/MaKaC/webinterface/rh/sessionModif.py

    diff --git a/indico/MaKaC/webinterface/rh/sessionModif.py b/indico/MaKaC/webinterface/rh/sessionModif.py
    index 8984a4b..b8cf40d 100644
    a b from MaKaC.PDFinterface.conference import ConfManagerContribsToPDF 
    4242from MaKaC.common import Config 
    4343from BTrees.OOBTree import OOBTree 
    4444from BTrees.IOBTree import IOBTree 
    45 from sets import Set 
    4645from datetime import datetime,timedelta,date 
    4746from MaKaC.errors import FormValuesError 
    4847from MaKaC.conference import SessionChair 
    class RHContribsParticipantList(RHSessionModUnrestrictedContribMngCoordBase): 
    13881387        speakers = OOBTree() 
    13891388        primaryAuthors = OOBTree() 
    13901389        coAuthors = OOBTree() 
    1391         speakerEmails = Set() 
    1392         primaryAuthorEmails = Set() 
    1393         coAuthorEmails = Set() 
     1390        speakerEmails = set() 
     1391        primaryAuthorEmails = set() 
     1392        coAuthorEmails = set() 
    13941393 
    13951394        self._setGroupsToDisplay() 
    13961395        for contribId in self._contribIds: 
  • indico/MaKaC/webinterface/rh/trackModif.py

    diff --git a/indico/MaKaC/webinterface/rh/trackModif.py b/indico/MaKaC/webinterface/rh/trackModif.py
    index b82a47f..b5eee4e 100644
    a b  
    1818## along with CDS Indico; if not, write to the Free Software Foundation, Inc., 
    1919## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
    2020 
    21 from sets import Set 
    2221 
    2322from BTrees.OOBTree import OOBTree 
    2423 
    class RHAbstractsParticipantList(RHTrackAbstractsBase): 
    749748        submitters = OOBTree() 
    750749        primaryAuthors = OOBTree() 
    751750        coAuthors = OOBTree() 
    752         submitterEmails = Set() 
    753         primaryAuthorEmails = Set() 
    754         coAuthorEmails = Set() 
     751        submitterEmails = set() 
     752        primaryAuthorEmails = set() 
     753        coAuthorEmails = set() 
    755754 
    756755        self._setGroupsToDisplay() 
    757756 
  • indico/MaKaC/webinterface/timetable.py

    diff --git a/indico/MaKaC/webinterface/timetable.py b/indico/MaKaC/webinterface/timetable.py
    index 14918c0..7b3b0bb 100644
    a b  
    2020 
    2121import MaKaC.schedule as schedule 
    2222import MaKaC.conference as conference 
    23 import sets 
    2423from datetime import timedelta,datetime 
    2524import pytz 
    2625from pytz import timezone 
    class Day(object): 
    537536        return False 
    538537 
    539538    def getContainerMaxOverlap(self): 
    540         contSet = sets.Set() 
     539        contSet = set() 
    541540        for slot in self.getSlotList(): 
    542             contSet.union_update( sets.Set(slot.getContainerList()) ) 
     541            contSet.update( set(slot.getContainerList()) ) 
    543542        max = 0 
    544543        for cont in contSet: 
    545544            max += cont.getMaxOverlap(self) 
    546545        return max 
    547546 
    548547    def getNumContainers(self): 
    549         containerSet = sets.Set() 
     548        containerSet = set() 
    550549        for slot in self.getSlotList(): 
    551             slotContainerSet = sets.Set(slot.getContainerList()) 
    552             containerSet.union_update(slotContainerSet) 
     550            slotContainerSet = set(slot.getContainerList()) 
     551            containerSet.update(slotContainerSet) 
    553552        return len(containerSet) 
    554553 
    555554    def removeSlot(self, slot): 
  • indico/htdocs/scripts/Forthcoming.py

    diff --git a/indico/htdocs/scripts/Forthcoming.py b/indico/htdocs/scripts/Forthcoming.py
    index 65878b3..7f9d31e 100644
    a b  
    1919## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
    2020 
    2121import sys,re 
    22 import sets 
    2322 
    2423from MaKaC.common.general import * 
    2524from MaKaC.common import db 
    def sortByStartDate(conf1,conf2): 
    8685 
    8786def getConfList(startdate,ids): 
    8887  #create result set 
    89   res = sets.Set() 
     88  res = set() 
    9089  #instanciate indexes 
    9190  im = indexes.IndexesHolder() 
    9291  catIdx = im.getIndex('category') 
    9392  calIdx = im.getIndex('calendar') 
    9493  c1 = calIdx.getObjectsStartingAfter(startdate) 
    9594  for id in ids: 
    96     confIds=sets.Set(catIdx.getItems(id)) 
     95    confIds=set(catIdx.getItems(id)) 
    9796    confIds.intersection_update(c1) 
    98     res.union_update(confIds) 
     97    res.update(confIds) 
    9998  res = list(res) 
    10099  res.sort(sortByStartDate) 
    101100  return res 
  • indico/htdocs/scripts/SSLPdisplay.py

    diff --git a/indico/htdocs/scripts/SSLPdisplay.py b/indico/htdocs/scripts/SSLPdisplay.py
    index c2f36b2..52c9189 100644
    a b def index(req, **params): 
    125125    for id in ids: 
    126126      confIds=sets.Set(catIdx.getItems(id)) 
    127127      confIds.intersection_update(c1) 
    128       res.union_update(confIds) 
     128      res.update(confIds) 
    129129 
    130130    res = list(res) 
    131131    res.sort(sortByStartDate) 
  • indico/htdocs/scripts/createCategoryHeader.py

    diff --git a/indico/htdocs/scripts/createCategoryHeader.py b/indico/htdocs/scripts/createCategoryHeader.py
    index 5492c0c..45afe32 100644
    a b def index(req, **params): 
    5757 
    5858  for cid in ids: 
    5959    confIds = calIdx.getObjectsInDays(cid, startdate, enddate) 
    60     res.union_update(confIds) 
     60    res.update(confIds) 
    6161 
    6262  res = list(res) 
    6363  res.sort(sortByStartDate) 
  • indico/tests/runners.py

    diff --git a/indico/tests/runners.py b/indico/tests/runners.py
    index d9dc7f7..6fb570b 100644
    a b class JSLintTestRunner(BaseTestRunner): 
    643643 
    644644        # Folders which are not going to be scanned. 
    645645        # Files are going to be find recursively in the other folders 
    646         import sets 
    647         blackList = sets.Set(['pack', 'Loader.js', 'Common', 'i18n']) 
     646        blackList = set(['pack', 'Loader.js', 'Common', 'i18n']) 
    648647 
    649648        #checking if rhino is accessible 
    650649        statusOutput = commands.getstatusoutput("rhino -?")