aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikraman Choudhury <vikraman.choudhury@gmail.com>2011-07-11 03:41:01 +0530
committerVikraman Choudhury <vikraman.choudhury@gmail.com>2011-07-11 03:41:01 +0530
commit77af65cd6469b4ac15cdcc16202d51c06869a350 (patch)
tree7fb5429357380cfe333a110fe00f67087e6c236c
parentfix tabs (diff)
downloadgentoostats-77af65cd6469b4ac15cdcc16202d51c06869a350.tar.gz
gentoostats-77af65cd6469b4ac15cdcc16202d51c06869a350.tar.bz2
gentoostats-77af65cd6469b4ac15cdcc16202d51c06869a350.zip
fixes after pylint
-rwxr-xr-xclient/gentoostats-send2
-rw-r--r--client/gentoostats/environment.py2
-rw-r--r--client/gentoostats/metadata.py4
-rw-r--r--client/gentoostats/packages.py4
-rw-r--r--client/gentoostats/payload.py32
-rw-r--r--server/host.py2
-rw-r--r--server/kwd.py2
-rw-r--r--server/package.py46
-rw-r--r--server/tests/test_host.py16
-rw-r--r--server/tests/test_index.py2
10 files changed, 56 insertions, 56 deletions
diff --git a/client/gentoostats-send b/client/gentoostats-send
index f2b7246..7c39a7a 100755
--- a/client/gentoostats-send
+++ b/client/gentoostats-send
@@ -51,7 +51,7 @@ def main():
post_url = '/' + post_url
post_url = post_url + '/host/' + post_data['AUTH']['UUID']
- post_body = serialize(post_data,human=True)
+ post_body = serialize(post_data, human=True)
post_headers = {'Content-type':'application/json'}
conn = httplib.HTTPSConnection(args['server'] + ':' + str(args['port']))
diff --git a/client/gentoostats/environment.py b/client/gentoostats/environment.py
index 2e92ca3..80e717b 100644
--- a/client/gentoostats/environment.py
+++ b/client/gentoostats/environment.py
@@ -34,7 +34,7 @@ class Environment(object):
if profilever is None:
try:
for parent in portage.grabfile(os.path.join(profile, 'parent')):
- profilever = relative_profile_path(self.portdir,os.path.join(profile, parent))
+ profilever = relative_profile_path(self.portdir, os.path.join(profile, parent))
if profilever is not None:
break
except portage.exception.PortageException:
diff --git a/client/gentoostats/metadata.py b/client/gentoostats/metadata.py
index fb36a12..7d13a4f 100644
--- a/client/gentoostats/metadata.py
+++ b/client/gentoostats/metadata.py
@@ -7,7 +7,7 @@ from gentoolkit.enalyze.lib import KeywordAnalyser
class Metadata(object):
def __init__(self, cpv):
- self.repo, self.counter, self.build_time, self.size = VARDB.aux_get(cpv,['repository','COUNTER','BUILD_TIME','SIZE'])
+ self.repo, self.counter, self.build_time, self.size = VARDB.aux_get(cpv, ['repository', 'COUNTER', 'BUILD_TIME', 'SIZE'])
system_use = portage.settings['USE'].split()
fa = FlagAnalyzer(system=system_use)
@@ -15,7 +15,7 @@ class Metadata(object):
arch = portage.settings['ARCH']
accept_keywords = portage.settings['ACCEPT_KEYWORDS'].split()
- ka = KeywordAnalyser(arch=arch,accept_keywords=accept_keywords)
+ ka = KeywordAnalyser(arch=arch, accept_keywords=accept_keywords)
self.keyword = ka.get_inst_keyword_cpv(cpv)
def getPlusFlags(self):
diff --git a/client/gentoostats/packages.py b/client/gentoostats/packages.py
index 2d8d677..39bbde9 100644
--- a/client/gentoostats/packages.py
+++ b/client/gentoostats/packages.py
@@ -11,8 +11,8 @@ class Packages(object):
return sorted(installed_cps)
return installed_cps
- def getInstalledCPVs(self,sort=False):
+ def getInstalledCPVs(self, sort=False):
installed_cpvs = VARDB.cpv_all()
if sort:
- return installed_cpvs
+ return sorted(installed_cpvs)
return installed_cpvs
diff --git a/client/gentoostats/payload.py b/client/gentoostats/payload.py
index 40532c5..1e98b75 100644
--- a/client/gentoostats/payload.py
+++ b/client/gentoostats/payload.py
@@ -29,35 +29,35 @@ class Payload(object):
def update(self):
env = Environment()
- self.payload['PLATFORM'] = 'Unknown' if self.__masked('ENV','PLATFORM') else env.getPlatform()
- self.payload['LASTSYNC'] = 'Unknown' if self.__masked('ENV','LASTSYNC') else env.getLastSync()
- self.payload['PROFILE'] = 'Unknown' if self.__masked('ENV','PROFILE') else env.getProfile()
+ self.payload['PLATFORM'] = 'Unknown' if self.__masked('ENV', 'PLATFORM') else env.getPlatform()
+ self.payload['LASTSYNC'] = 'Unknown' if self.__masked('ENV', 'LASTSYNC') else env.getLastSync()
+ self.payload['PROFILE'] = 'Unknown' if self.__masked('ENV', 'PROFILE') else env.getProfile()
- for var in ['ARCH','CHOST','CFLAGS','CXXFLAGS','FFLAGS','LDFLAGS','MAKEOPTS','SYNC']:
- self.payload[var] = None if self.__masked('ENV',var) else env.getVar(var)
+ for var in ['ARCH', 'CHOST', 'CFLAGS', 'CXXFLAGS', 'FFLAGS', 'LDFLAGS', 'MAKEOPTS', 'SYNC']:
+ self.payload[var] = None if self.__masked('ENV', var) else env.getVar(var)
- for var in ['ACCEPT_KEYWORDS','LANG','GENTOO_MIRRORS','FEATURES','USE']:
- self.payload[var] = [] if self.__masked('ENV',var) else env.getVar(var).split()
+ for var in ['ACCEPT_KEYWORDS', 'LANG', 'GENTOO_MIRRORS', 'FEATURES', 'USE']:
+ self.payload[var] = [] if self.__masked('ENV', var) else env.getVar(var).split()
self.payload['PACKAGES'] = dict()
for cpv in Packages().getInstalledCPVs():
m = Metadata(cpv)
p = dict()
- p['REPO'] = None if self.__masked('PACKAGES','REPO') else m.getRepoName()
- p['KEYWORD'] = None if self.__masked('PACKAGES','KEYWORD') else m.getKeyword()
+ p['REPO'] = None if self.__masked('PACKAGES', 'REPO') else m.getRepoName()
+ p['KEYWORD'] = None if self.__masked('PACKAGES', 'KEYWORD') else m.getKeyword()
p['USE'] = dict()
- p['USE']['PLUS'] = [] if self.__masked('PACKAGES','USE_PLUS') else m.getPlusFlags()
- p['USE']['MINUS'] = [] if self.__masked('PACKAGES','USE_MINUS') else m.getMinusFlags()
- p['USE']['UNSET'] = [] if self.__masked('PACKAGES','USE_UNSET') else m.getUnsetFlags()
- p['COUNTER'] = None if self.__masked('PACKAGES','COUNTER') else m.getCounter()
- p['SIZE'] = None if self.__masked('PACKAGES','SIZE') else m.getSize()
- p['BUILD_TIME'] = None if self.__masked('PACKAGES','BUILD_TIME') else m.getBuildTime()
+ p['USE']['PLUS'] = [] if self.__masked('PACKAGES', 'USE_PLUS') else m.getPlusFlags()
+ p['USE']['MINUS'] = [] if self.__masked('PACKAGES', 'USE_MINUS') else m.getMinusFlags()
+ p['USE']['UNSET'] = [] if self.__masked('PACKAGES', 'USE_UNSET') else m.getUnsetFlags()
+ p['COUNTER'] = None if self.__masked('PACKAGES', 'COUNTER') else m.getCounter()
+ p['SIZE'] = None if self.__masked('PACKAGES', 'SIZE') else m.getSize()
+ p['BUILD_TIME'] = None if self.__masked('PACKAGES', 'BUILD_TIME') else m.getBuildTime()
self.payload['PACKAGES'][cpv] = p
def get(self):
return self.payload
- def dump(self,human=False):
+ def dump(self, human=False):
if human:
pprint.pprint(self.payload)
else:
diff --git a/server/host.py b/server/host.py
index 03bc2ba..6d1f6f3 100644
--- a/server/host.py
+++ b/server/host.py
@@ -21,7 +21,7 @@ class Host(object):
env = db.select('ENV', vars={'uuid':uuid}, where="UUID=$uuid")
e = env[0]
- for var in ['PLATFORM','LASTSYNC','PROFILE','ARCH','CHOST','CFLAGS','CXXFLAGS','FFLAGS','LDFLAGS','MAKEOPTS','SYNC']:
+ for var in ['PLATFORM', 'LASTSYNC', 'PROFILE', 'ARCH', 'CHOST', 'CFLAGS', 'CXXFLAGS', 'FFLAGS', 'LDFLAGS', 'MAKEOPTS', 'SYNC']:
host_data[var] = e[var]
host_data['FEATURES'] = list()
diff --git a/server/kwd.py b/server/kwd.py
index c5f3403..6cef893 100644
--- a/server/kwd.py
+++ b/server/kwd.py
@@ -6,5 +6,5 @@ class Keyword(object):
keyword_count = db.query('SELECT KEYWORD, COUNT(DISTINCT IPKEY) AS PACKAGES, COUNT(DISTINCT UUID) AS HOSTS FROM GLOBAL_KEYWORDS NATURAL JOIN KEYWORDS NATURAL JOIN INSTALLED_PACKAGES GROUP BY KEYWORD')
keyword_data = dict()
for t in keyword_count:
- keyword_data[t['KEYWORD']] = {'HOSTS':t['HOSTS'],'PACKAGES':t['PACKAGES']}
+ keyword_data[t['KEYWORD']] = {'HOSTS':t['HOSTS'], 'PACKAGES':t['PACKAGES']}
return render.keyword(keyword_data)
diff --git a/server/package.py b/server/package.py
index 58e3066..adc2d94 100644
--- a/server/package.py
+++ b/server/package.py
@@ -24,10 +24,10 @@ class Package(object):
return config.internalerror()
def __GET(self, top):
- p_query = db.query('SELECT COUNT(DISTINCT UUID) AS HOST_COUNT,\
- COUNT(DISTINCT CAT) AS C_COUNT,\
- COUNT(DISTINCT CAT,PKG) AS CP_COUNT,\
- COUNT(DISTINCT CAT,PKG,VER) AS CPV_COUNT\
+ p_query = db.query('SELECT COUNT(DISTINCT UUID) AS HOST_COUNT, \
+ COUNT(DISTINCT CAT) AS C_COUNT, \
+ COUNT(DISTINCT CAT, PKG) AS CP_COUNT, \
+ COUNT(DISTINCT CAT, PKG, VER) AS CPV_COUNT\
FROM INSTALLED_PACKAGES RIGHT OUTER JOIN PACKAGES\
ON INSTALLED_PACKAGES.PKEY = PACKAGES.PKEY')
p_tuple = p_query[0]
@@ -41,9 +41,9 @@ class Package(object):
return render.package(p_data)
def __GET_C(self, top, cat):
- p_query = db.query('SELECT COUNT(DISTINCT UUID) AS HOST_COUNT,\
- COUNT(DISTINCT CAT,PKG) AS CP_COUNT,\
- COUNT(DISTINCT CAT,PKG,VER) AS CPV_COUNT\
+ p_query = db.query('SELECT COUNT(DISTINCT UUID) AS HOST_COUNT, \
+ COUNT(DISTINCT CAT, PKG) AS CP_COUNT, \
+ COUNT(DISTINCT CAT, PKG, VER) AS CPV_COUNT\
FROM INSTALLED_PACKAGES RIGHT OUTER JOIN PACKAGES\
ON INSTALLED_PACKAGES.PKEY = PACKAGES.PKEY\
WHERE CAT=$cat', vars={'cat':cat})
@@ -57,11 +57,11 @@ class Package(object):
return render.package_c(cat, p_data)
def __GET_CP(self, top, cat, pkg):
- p_query = db.query('SELECT COUNT(DISTINCT UUID) AS HOST_COUNT,\
- COUNT(DISTINCT CAT,PKG,VER) AS CPV_COUNT\
+ p_query = db.query('SELECT COUNT(DISTINCT UUID) AS HOST_COUNT, \
+ COUNT(DISTINCT CAT, PKG, VER) AS CPV_COUNT\
FROM INSTALLED_PACKAGES RIGHT OUTER JOIN PACKAGES\
ON INSTALLED_PACKAGES.PKEY = PACKAGES.PKEY\
- WHERE CAT=$cat AND PKG=$pkg', vars={'cat':cat,'pkg':pkg})
+ WHERE CAT=$cat AND PKG=$pkg', vars={'cat':cat, 'pkg':pkg})
p_tuple = p_query[0]
p_data = {
'HOST_COUNT':p_tuple['HOST_COUNT'],
@@ -74,7 +74,7 @@ class Package(object):
p_query = db.query('SELECT COUNT(DISTINCT UUID) AS HOST_COUNT\
FROM INSTALLED_PACKAGES RIGHT OUTER JOIN PACKAGES\
ON INSTALLED_PACKAGES.PKEY = PACKAGES.PKEY\
- WHERE CAT=$cat AND PKG=$pkg AND VER=$ver', vars={'cat':cat,'pkg':pkg,'ver':ver})
+ WHERE CAT=$cat AND PKG=$pkg AND VER=$ver', vars={'cat':cat, 'pkg':pkg, 'ver':ver})
p_tuple = p_query[0]
p_data = {
'HOST_COUNT':p_tuple['HOST_COUNT'],
@@ -84,12 +84,12 @@ class Package(object):
def __top(self, count, *args):
t_list = list()
if len(args) == 0:
- tc_query = db.query('SELECT CAT,COUNT(DISTINCT UUID) AS HOST_COUNT\
+ tc_query = db.query('SELECT CAT, COUNT(DISTINCT UUID) AS HOST_COUNT\
FROM INSTALLED_PACKAGES RIGHT OUTER JOIN PACKAGES\
ON INSTALLED_PACKAGES.PKEY = PACKAGES.PKEY\
GROUP BY CAT\
- ORDER BY HOST_COUNT DESC,CAT')
- for idx in range(0,count):
+ ORDER BY HOST_COUNT DESC, CAT')
+ for idx in range(0, count):
try:
tc_tuple = tc_query[idx]
t_list.append({
@@ -100,14 +100,14 @@ class Package(object):
break
elif len(args) == 1:
- tcp_query = db.query('SELECT CAT,PKG,COUNT(DISTINCT UUID) AS HOST_COUNT\
+ tcp_query = db.query('SELECT CAT, PKG, COUNT(DISTINCT UUID) AS HOST_COUNT\
FROM INSTALLED_PACKAGES RIGHT OUTER JOIN PACKAGES\
ON INSTALLED_PACKAGES.PKEY = PACKAGES.PKEY\
WHERE CAT=$cat\
- GROUP BY CAT,PKG\
- ORDER BY HOST_COUNT DESC,CAT,PKG',
+ GROUP BY CAT, PKG\
+ ORDER BY HOST_COUNT DESC, CAT, PKG',
vars={'cat':args[0]})
- for idx in range(0,count):
+ for idx in range(0, count):
try:
tcp_tuple = tcp_query[idx]
t_list.append({
@@ -119,14 +119,14 @@ class Package(object):
break
elif len(args) == 2:
- tcpv_query = db.query('SELECT CAT,PKG,VER,COUNT(DISTINCT UUID) AS HOST_COUNT\
+ tcpv_query = db.query('SELECT CAT, PKG, VER, COUNT(DISTINCT UUID) AS HOST_COUNT\
FROM INSTALLED_PACKAGES RIGHT OUTER JOIN PACKAGES\
ON INSTALLED_PACKAGES.PKEY = PACKAGES.PKEY\
WHERE CAT=$cat AND PKG=$pkg\
- GROUP BY CAT,PKG,VER\
- ORDER BY HOST_COUNT DESC,CAT,PKG,VER',
- vars={'cat':args[0],'pkg':args[1]})
- for idx in range(0,count):
+ GROUP BY CAT, PKG, VER\
+ ORDER BY HOST_COUNT DESC, CAT, PKG, VER',
+ vars={'cat':args[0], 'pkg':args[1]})
+ for idx in range(0, count):
try:
tcpv_tuple = tcpv_query[idx]
t_list.append({
diff --git a/server/tests/test_host.py b/server/tests/test_host.py
index a5e723b..b781a09 100644
--- a/server/tests/test_host.py
+++ b/server/tests/test_host.py
@@ -38,7 +38,7 @@ class TestHost(unittest.TestCase):
self.assertEqual(self.b.status, 500)
# post with empty payload
payload = {
- 'AUTH':{'UUID':str_uuid,'PASSWD':'test'},
+ 'AUTH':{'UUID':str_uuid, 'PASSWD':'test'},
'PROTOCOL':1
}
data = json.JSONEncoder().encode(payload)
@@ -51,11 +51,11 @@ class TestHost(unittest.TestCase):
uri = '/host/' + str_uuid
# different uuid in payload
payload = {
- 'AUTH':{'UUID':str(uuid.uuid4()),'PASSWD':'test'},
+ 'AUTH':{'UUID':str(uuid.uuid4()), 'PASSWD':'test'},
'PROTOCOL':1
}
data = json.JSONEncoder().encode(payload)
- self.b.open(uri,data)
+ self.b.open(uri, data)
self.assertEqual(self.b.path, uri)
self.assertEqual(self.b.status, 200)
self.assertTrue('Invalid uuid' in self.b.data)
@@ -64,18 +64,18 @@ class TestHost(unittest.TestCase):
str_uuid = str(uuid.uuid4())
uri = '/host/' + str_uuid
payload = {
- 'AUTH':{'UUID':str_uuid,'PASSWD':'test'},
+ 'AUTH':{'UUID':str_uuid, 'PASSWD':'test'},
'PROTOCOL':1
}
- for var in ['PLATFORM','PROFILE','LASTSYNC']:
+ for var in ['PLATFORM', 'PROFILE', 'LASTSYNC']:
payload[var] = 'Unknown'
- for var in ['ARCH','CHOST','CFLAGS','CXXFLAGS','FFLAGS','LDFLAGS','MAKEOPTS','SYNC']:
+ for var in ['ARCH', 'CHOST', 'CFLAGS', 'CXXFLAGS', 'FFLAGS', 'LDFLAGS', 'MAKEOPTS', 'SYNC']:
payload[var] = None
- for var in ['ACCEPT_KEYWORDS','LANG','GENTOO_MIRRORS','FEATURES','USE']:
+ for var in ['ACCEPT_KEYWORDS', 'LANG', 'GENTOO_MIRRORS', 'FEATURES', 'USE']:
payload[var] = []
payload['PACKAGES'] = {}
data = json.JSONEncoder().encode(payload)
- self.b.open(uri,data)
+ self.b.open(uri, data)
self.assertEqual(self.b.path, uri)
self.assertEqual(self.b.status, 200)
self.assertTrue('POST for ' + str_uuid + ' successful' in self.b.data)
diff --git a/server/tests/test_index.py b/server/tests/test_index.py
index 2796c1d..f77a60d 100644
--- a/server/tests/test_index.py
+++ b/server/tests/test_index.py
@@ -22,5 +22,5 @@ class TestIndex(unittest.TestCase):
if line.startswith('Number of hosts'):
words = line.split()
count = int(words[-1].strip('</br>'))
- self.assertGreaterEqual(count,0)
+ self.assertGreaterEqual(count, 0)
break