-
Notifications
You must be signed in to change notification settings - Fork 0
/
Library.py
executable file
·84 lines (71 loc) · 2.2 KB
/
Library.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
'''
Created on 1-aug-2009
@author: Chton
'''
import random
import time
import threading
import Queue
class Library(object):
'''
classdocs
'''
ListByPerson = {}
ListByRepos = {}
ListNeighbours = {}
TestList = {}
ListSecondGenerationRepos = {}
PreTestList = []
ListData = []
TableConn = {}
TableRepos = {}
ChildrenList = {}
ReposData = {}
def __init__(self):
'''
Constructor
'''
i=0
print "BEGIN FILLING LISTS"
# for key in range ( 100000 ):
# self.ListByPerson[str(i)] = []
# i = i + 1
i=0
# for key in range ( 124000 ):
# self.ListByRepos[str(i)] = []
# i = i+1
self.TestList = {}
print "END FILLING LISTS"
def processData(self):
print "FILLING ADDITIONAL LIBS"
userpool = Queue.Queue ( 0 )
#print len(self.PreTestList)
userpool.put(0)
ThreadedLibCalcer(self, userpool).start()
while not userpool.empty():
time.sleep(1)
print "FINISHED FILLING ADDITIONAL LIBS"
class ThreadedLibCalcer( threading.Thread ):
def __init__(self, lib, userpool):
self.lib = lib
self.ListByPerson = lib.ListByPerson
self.ListByRepos = lib.ListByRepos
self.ListNeighbours = lib.ListNeighbours
self.ListSecondGenerationRepos = lib.ListSecondGenerationRepos
self.userpool = userpool
self.TableConn = lib.TableConn
self.TableRepos = lib.TableRepos
self.PreTestList = lib.PreTestList
threading.Thread.__init__ ( self )
def run(self):
i = 0
p = 0
for user in self.PreTestList:
if not user in self.ListByPerson:
self.ListByPerson[user] = []
self.lib.TestList[user] = []
self.userpool.get()
def sortByMostOcc(self, list):
def comparer(left, right):
return list.count(left) - list.count(right)
return sorted(list, comparer)