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 |
22 | 22 | import sys |
23 | 23 | ## TO BE CHANGED: |
24 | 24 | #sys.path.append('C:/Documents and Settings/smilenko/My Documents/project/indico/code/code') |
25 | | import sets |
26 | 25 | from distutils import sysconfig |
27 | 26 | from datetime import datetime |
28 | 27 | from MaKaC.common import Config |
… |
… |
python = os.path.join(sysconfig.get_config_vars()["exec_prefix"], "python") |
41 | 40 | repozo = "C:/Python23/Scripts/repozo.py" |
42 | 41 | |
43 | 42 | def main(): |
44 | | tmp = sets.Set(os.listdir(backupsPath)) |
| 43 | tmp = set(os.listdir(backupsPath)) |
45 | 44 | name = datetime.utcnow().strftime("%Y-%m-%d-%H-%M-%S") |
46 | 45 | os.system("%s %s %s %s %s %s %s %s %s"%(python, repozo, "-B", "-f",\ |
47 | 46 | "\"%s\""%os.path.join(currentPath, dataFile), "-F", "-z", "-r",\ |
48 | 47 | "\"%s\""%backupsPath)) |
49 | | names = sets.Set(os.listdir(backupsPath)) |
| 48 | names = set(os.listdir(backupsPath)) |
50 | 49 | names.difference_update(tmp) |
51 | 50 | for n in names: |
52 | 51 | os.rename(os.path.join(backupsPath, n), os.path.join(backupsPath,\ |
diff --git a/indico/MaKaC/booking.py b/indico/MaKaC/booking.py
index f4d342c..ce1be9b 100644
a
|
b
|
|
21 | 21 | import os |
22 | 22 | import re |
23 | 23 | import tempfile |
24 | | import sets |
25 | 24 | import os.path |
26 | 25 | import copy |
27 | 26 | from pytz import timezone |
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): |
7583 | 7583 | if self._aw.getUser() is None: |
7584 | 7584 | return "" |
7585 | 7585 | #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()))) |
7589 | 7588 | if len(ls)<=0: |
7590 | 7589 | return "" |
7591 | 7590 | res=[] |
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 |
29 | 29 | import MaKaC.webinterface.common.timezones as convertTime |
30 | 30 | import MaKaC.common.timezoneUtils as timezoneUtils |
31 | 31 | from BTrees.OOBTree import OOBTree |
32 | | from sets import Set |
33 | 32 | from MaKaC.webinterface.common.abstractDataWrapper import AbstractParam |
34 | 33 | import MaKaC.review as review |
35 | 34 | import MaKaC.webinterface.urlHandlers as urlHandlers |
… |
… |
class RHAbstractsParticipantList(RHConfModifCFABase): |
5113 | 5112 | submitters = OOBTree() |
5114 | 5113 | primaryAuthors = OOBTree() |
5115 | 5114 | coAuthors = OOBTree() |
5116 | | submitterEmails = Set() |
5117 | | primaryAuthorEmails = Set() |
5118 | | coAuthorEmails = Set() |
| 5115 | submitterEmails = set() |
| 5116 | primaryAuthorEmails = set() |
| 5117 | coAuthorEmails = set() |
5119 | 5118 | |
5120 | 5119 | self._setGroupsToDisplay() |
5121 | 5120 | |
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 |
42 | 42 | from MaKaC.common import Config |
43 | 43 | from BTrees.OOBTree import OOBTree |
44 | 44 | from BTrees.IOBTree import IOBTree |
45 | | from sets import Set |
46 | 45 | from datetime import datetime,timedelta,date |
47 | 46 | from MaKaC.errors import FormValuesError |
48 | 47 | from MaKaC.conference import SessionChair |
… |
… |
class RHContribsParticipantList(RHSessionModUnrestrictedContribMngCoordBase): |
1388 | 1387 | speakers = OOBTree() |
1389 | 1388 | primaryAuthors = OOBTree() |
1390 | 1389 | coAuthors = OOBTree() |
1391 | | speakerEmails = Set() |
1392 | | primaryAuthorEmails = Set() |
1393 | | coAuthorEmails = Set() |
| 1390 | speakerEmails = set() |
| 1391 | primaryAuthorEmails = set() |
| 1392 | coAuthorEmails = set() |
1394 | 1393 | |
1395 | 1394 | self._setGroupsToDisplay() |
1396 | 1395 | for contribId in self._contribIds: |
diff --git a/indico/MaKaC/webinterface/rh/trackModif.py b/indico/MaKaC/webinterface/rh/trackModif.py
index b82a47f..b5eee4e 100644
a
|
b
|
|
18 | 18 | ## along with CDS Indico; if not, write to the Free Software Foundation, Inc., |
19 | 19 | ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | |
21 | | from sets import Set |
22 | 21 | |
23 | 22 | from BTrees.OOBTree import OOBTree |
24 | 23 | |
… |
… |
class RHAbstractsParticipantList(RHTrackAbstractsBase): |
749 | 748 | submitters = OOBTree() |
750 | 749 | primaryAuthors = OOBTree() |
751 | 750 | coAuthors = OOBTree() |
752 | | submitterEmails = Set() |
753 | | primaryAuthorEmails = Set() |
754 | | coAuthorEmails = Set() |
| 751 | submitterEmails = set() |
| 752 | primaryAuthorEmails = set() |
| 753 | coAuthorEmails = set() |
755 | 754 | |
756 | 755 | self._setGroupsToDisplay() |
757 | 756 | |
diff --git a/indico/MaKaC/webinterface/timetable.py b/indico/MaKaC/webinterface/timetable.py
index 14918c0..7b3b0bb 100644
a
|
b
|
|
20 | 20 | |
21 | 21 | import MaKaC.schedule as schedule |
22 | 22 | import MaKaC.conference as conference |
23 | | import sets |
24 | 23 | from datetime import timedelta,datetime |
25 | 24 | import pytz |
26 | 25 | from pytz import timezone |
… |
… |
class Day(object): |
537 | 536 | return False |
538 | 537 | |
539 | 538 | def getContainerMaxOverlap(self): |
540 | | contSet = sets.Set() |
| 539 | contSet = set() |
541 | 540 | for slot in self.getSlotList(): |
542 | | contSet.union_update( sets.Set(slot.getContainerList()) ) |
| 541 | contSet.update( set(slot.getContainerList()) ) |
543 | 542 | max = 0 |
544 | 543 | for cont in contSet: |
545 | 544 | max += cont.getMaxOverlap(self) |
546 | 545 | return max |
547 | 546 | |
548 | 547 | def getNumContainers(self): |
549 | | containerSet = sets.Set() |
| 548 | containerSet = set() |
550 | 549 | 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) |
553 | 552 | return len(containerSet) |
554 | 553 | |
555 | 554 | def removeSlot(self, slot): |
diff --git a/indico/htdocs/scripts/Forthcoming.py b/indico/htdocs/scripts/Forthcoming.py
index 65878b3..7f9d31e 100644
a
|
b
|
|
19 | 19 | ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. |
20 | 20 | |
21 | 21 | import sys,re |
22 | | import sets |
23 | 22 | |
24 | 23 | from MaKaC.common.general import * |
25 | 24 | from MaKaC.common import db |
… |
… |
def sortByStartDate(conf1,conf2): |
86 | 85 | |
87 | 86 | def getConfList(startdate,ids): |
88 | 87 | #create result set |
89 | | res = sets.Set() |
| 88 | res = set() |
90 | 89 | #instanciate indexes |
91 | 90 | im = indexes.IndexesHolder() |
92 | 91 | catIdx = im.getIndex('category') |
93 | 92 | calIdx = im.getIndex('calendar') |
94 | 93 | c1 = calIdx.getObjectsStartingAfter(startdate) |
95 | 94 | for id in ids: |
96 | | confIds=sets.Set(catIdx.getItems(id)) |
| 95 | confIds=set(catIdx.getItems(id)) |
97 | 96 | confIds.intersection_update(c1) |
98 | | res.union_update(confIds) |
| 97 | res.update(confIds) |
99 | 98 | res = list(res) |
100 | 99 | res.sort(sortByStartDate) |
101 | 100 | return res |
diff --git a/indico/htdocs/scripts/SSLPdisplay.py b/indico/htdocs/scripts/SSLPdisplay.py
index c2f36b2..52c9189 100644
a
|
b
|
def index(req, **params): |
125 | 125 | for id in ids: |
126 | 126 | confIds=sets.Set(catIdx.getItems(id)) |
127 | 127 | confIds.intersection_update(c1) |
128 | | res.union_update(confIds) |
| 128 | res.update(confIds) |
129 | 129 | |
130 | 130 | res = list(res) |
131 | 131 | res.sort(sortByStartDate) |
diff --git a/indico/htdocs/scripts/createCategoryHeader.py b/indico/htdocs/scripts/createCategoryHeader.py
index 5492c0c..45afe32 100644
a
|
b
|
def index(req, **params): |
57 | 57 | |
58 | 58 | for cid in ids: |
59 | 59 | confIds = calIdx.getObjectsInDays(cid, startdate, enddate) |
60 | | res.union_update(confIds) |
| 60 | res.update(confIds) |
61 | 61 | |
62 | 62 | res = list(res) |
63 | 63 | res.sort(sortByStartDate) |
diff --git a/indico/tests/runners.py b/indico/tests/runners.py
index d9dc7f7..6fb570b 100644
a
|
b
|
class JSLintTestRunner(BaseTestRunner): |
643 | 643 | |
644 | 644 | # Folders which are not going to be scanned. |
645 | 645 | # 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']) |
648 | 647 | |
649 | 648 | #checking if rhino is accessible |
650 | 649 | statusOutput = commands.getstatusoutput("rhino -?") |