Switch to unified view

a/OSSEval/OpenSourceProject/flossmole.py b/OSSEval/OpenSourceProject/flossmole.py
...
...
3
# distributed with this file, You can obtain one at http://www.gnu.org/licenses/agpl.txt
3
# distributed with this file, You can obtain one at http://www.gnu.org/licenses/agpl.txt
4
#
4
#
5
# OSSeval is powered by the SOS Open Source AGPL edition.
5
# OSSeval is powered by the SOS Open Source AGPL edition.
6
#  The AGPL requires that you do not remove the SOS Open Source attribution and copyright 
6
#  The AGPL requires that you do not remove the SOS Open Source attribution and copyright 
7
#  notices from the user interface (see section 5.d below).
7
#  notices from the user interface (see section 5.d below).
8
#  Commercial licenses are available and do not require any SOS Open Source attributions
9
#  or visible copyright notices but they are not permitted under this license.
10
8
11
# OSSEval Copyright 2014 Bitergium SLL
9
# OSSEval Copyright 2014 Bitergium SLL
12
# SOS Open Source Copyright 2012 Roberto Galoppini
10
# SOS Open Source Copyright 2012 Roberto Galoppini
13
# Author: Davide Galletti 
11
# Author: Davide Galletti 
14
12
...
...
21
class FSF():
19
class FSF():
22
20
23
    @staticmethod
21
    @staticmethod
24
    def search(name):
22
    def search(name):
25
        project_list = []
23
        project_list = []
26
        cursor = connections['local_flossmole'].cursor()
24
        cursor = connections['flossmole'].cursor()
27
        parameters = { 'limit': Configuration.max_number_of_records } 
25
        parameters = { 'limit': Configuration.max_number_of_records } 
28
        cursor.execute("SELECT proj_unixname, datasource_id, proj_long_name, desc_long FROM fsf_projects WHERE LOWER(proj_unixname) LIKE '%%" + name.lower() + "%%' LIMIT %(limit)s", parameters)
26
        cursor.execute("SELECT proj_unixname, datasource_id, proj_long_name, desc_long FROM fsf_projects WHERE LOWER(proj_unixname) LIKE '%%" + name.lower() + "%%' LIMIT %(limit)s", parameters)
29
        results = cursor.fetchall()
27
        results = cursor.fetchall()
30
        for record in results:
28
        for record in results:
31
            fp = FlossmoleProject()
29
            fp = FlossmoleProject()
...
...
38
        return project_list
36
        return project_list
39
37
40
    @staticmethod
38
    @staticmethod
41
    def getProjectInfo(project_identifier):
39
    def getProjectInfo(project_identifier):
42
        info = {}
40
        info = {}
43
        cursor = connections['local_flossmole'].cursor()
41
        cursor = connections['flossmole'].cursor()
44
        cursor.execute("SELECT max(datasource_id) FROM fsf_projects")
42
        cursor.execute("SELECT max(datasource_id) FROM fsf_projects")
45
        row = cursor.fetchone()
43
        row = cursor.fetchone()
46
        datasource_id = row[0]
44
        datasource_id = row[0]
47
        parameters = { 'datasource_id': datasource_id, 'project_identifier': project_identifier } 
45
        parameters = { 'datasource_id': datasource_id, 'project_identifier': project_identifier } 
48
        cursor.execute("SELECT proj_long_name, desc_long, url, real_url, released_on, proj_num FROM fsf_projects WHERE proj_unixname=%(project_identifier)s and datasource_id=%(datasource_id)s", parameters)
46
        cursor.execute("SELECT proj_long_name, desc_long, url, real_url, released_on, proj_num FROM fsf_projects WHERE proj_unixname=%(project_identifier)s and datasource_id=%(datasource_id)s", parameters)
...
...
91
89
92
class FC():
90
class FC():
93
    @staticmethod
91
    @staticmethod
94
    def search(name):
92
    def search(name):
95
        project_list = []
93
        project_list = []
96
        cursor = connections['local_flossmole'].cursor()
94
        cursor = connections['flossmole'].cursor()
97
        parameters = { 'name': name, 'limit': Configuration.max_number_of_records } 
95
        parameters = { 'name': name, 'limit': Configuration.max_number_of_records } 
98
        cursor.execute("SELECT project_id, datasource_id, projectname_full, desc_short FROM fm_projects WHERE LOWER(projectname_full) LIKE '%%" + name.lower() + "%%' LIMIT %(limit)s", parameters)
96
        cursor.execute("SELECT project_id, datasource_id, projectname_full, desc_short FROM fm_projects WHERE LOWER(projectname_full) LIKE '%%" + name.lower() + "%%' LIMIT %(limit)s", parameters)
99
        results = cursor.fetchall()
97
        results = cursor.fetchall()
100
        for record in results:
98
        for record in results:
101
            fp = FlossmoleProject()
99
            fp = FlossmoleProject()
...
...
107
            project_list.append(fp)
105
            project_list.append(fp)
108
        return project_list
106
        return project_list
109
    @staticmethod
107
    @staticmethod
110
    def getProjectInfo(project_identifier):
108
    def getProjectInfo(project_identifier):
111
        info = {}
109
        info = {}
112
        cursor = connections['local_flossmole'].cursor()
110
        cursor = connections['flossmole'].cursor()
113
        cursor.execute("SELECT max(datasource_id) FROM fm_projects")
111
        cursor.execute("SELECT max(datasource_id) FROM fm_projects")
114
        row = cursor.fetchone()
112
        row = cursor.fetchone()
115
        datasource_id = row[0]
113
        datasource_id = row[0]
116
        parameters = { 'datasource_id': datasource_id, 'project_identifier': project_identifier }
114
        parameters = { 'datasource_id': datasource_id, 'project_identifier': project_identifier }
117
        cursor.execute('''SELECT date_added, date_updated, projectname_full, desc_short, desc_full, vitality_score, 
115
        cursor.execute('''SELECT date_added, date_updated, projectname_full, desc_short, desc_full, vitality_score, 
...
...
173
171
174
class GC():
172
class GC():
175
    @staticmethod
173
    @staticmethod
176
    def search(name):
174
    def search(name):
177
        project_list = []
175
        project_list = []
178
        cursor = connections['local_flossmole'].cursor()
176
        cursor = connections['flossmole'].cursor()
179
        parameters = { 'name': name, 'limit': Configuration.max_number_of_records } 
177
        parameters = { 'name': name, 'limit': Configuration.max_number_of_records } 
180
        cursor.execute("SELECT proj_name, datasource_id, proj_name, project_summary FROM gc_projects WHERE LOWER(proj_name) LIKE '%%" + name.lower() + "%%' LIMIT %(limit)s", parameters)
178
        cursor.execute("SELECT proj_name, datasource_id, proj_name, project_summary FROM gc_projects WHERE LOWER(proj_name) LIKE '%%" + name.lower() + "%%' LIMIT %(limit)s", parameters)
181
        results = cursor.fetchall()
179
        results = cursor.fetchall()
182
        for record in results:
180
        for record in results:
183
            fp = FlossmoleProject()
181
            fp = FlossmoleProject()
...
...
189
            project_list.append(fp)
187
            project_list.append(fp)
190
        return project_list
188
        return project_list
191
    @staticmethod
189
    @staticmethod
192
    def getProjectInfo(project_identifier):
190
    def getProjectInfo(project_identifier):
193
        info = {}
191
        info = {}
194
        cursor = connections['local_flossmole'].cursor()
192
        cursor = connections['flossmole'].cursor()
195
        cursor.execute("SELECT max(datasource_id) FROM gc_projects")
193
        cursor.execute("SELECT max(datasource_id) FROM gc_projects")
196
        row = cursor.fetchone()
194
        row = cursor.fetchone()
197
        datasource_id = row[0]
195
        datasource_id = row[0]
198
        parameters = { 'datasource_id': datasource_id, 'project_identifier': project_identifier } 
196
        parameters = { 'datasource_id': datasource_id, 'project_identifier': project_identifier } 
199
        cursor.execute("SELECT last_updated, code_license, code_url, project_summary, project_description FROM gc_projects WHERE proj_name=%(project_identifier)s and datasource_id=%(datasource_id)s", parameters)
197
        cursor.execute("SELECT last_updated, code_license, code_url, project_summary, project_description FROM gc_projects WHERE proj_name=%(project_identifier)s and datasource_id=%(datasource_id)s", parameters)
...
...
251
249
252
class GH():
250
class GH():
253
    @staticmethod
251
    @staticmethod
254
    def search(name):
252
    def search(name):
255
        project_list = []
253
        project_list = []
256
        cursor = connections['local_flossmole'].cursor()
254
        cursor = connections['flossmole'].cursor()
257
        parameters = { 'name': name, 'limit': Configuration.max_number_of_records } 
255
        parameters = { 'name': name, 'limit': Configuration.max_number_of_records } 
258
        cursor.execute("SELECT project_name, datasource_id, project_name, description FROM gh_projects WHERE LOWER(project_name) LIKE '%%" + name.lower() + "%%' LIMIT %(limit)s", parameters)
256
        cursor.execute("SELECT project_name, datasource_id, project_name, description FROM gh_projects WHERE LOWER(project_name) LIKE '%%" + name.lower() + "%%' LIMIT %(limit)s", parameters)
259
        results = cursor.fetchall()
257
        results = cursor.fetchall()
260
        for record in results:
258
        for record in results:
261
            fp = FlossmoleProject()
259
            fp = FlossmoleProject()
...
...
267
            project_list.append(fp)
265
            project_list.append(fp)
268
        return project_list
266
        return project_list
269
    @staticmethod
267
    @staticmethod
270
    def getProjectInfo(project_identifier):
268
    def getProjectInfo(project_identifier):
271
        info = {}
269
        info = {}
272
        cursor = connections['local_flossmole'].cursor()
270
        cursor = connections['flossmole'].cursor()
273
        cursor.execute("SELECT max(datasource_id) FROM gh_projects")
271
        cursor.execute("SELECT max(datasource_id) FROM gh_projects")
274
        row = cursor.fetchone()
272
        row = cursor.fetchone()
275
        datasource_id = row[0]
273
        datasource_id = row[0]
276
        parameters = { 'datasource_id': datasource_id, 'project_identifier': project_identifier } 
274
        parameters = { 'datasource_id': datasource_id, 'project_identifier': project_identifier } 
277
        cursor.execute("SELECT developer_name, description FROM gh_projects WHERE project_name=%(project_identifier)s and datasource_id=%(datasource_id)s", parameters)
275
        cursor.execute("SELECT developer_name, description FROM gh_projects WHERE project_name=%(project_identifier)s and datasource_id=%(datasource_id)s", parameters)