Convert _is_int to a function.

This commit is contained in:
Alberto Planas 2014-03-10 13:37:29 +01:00
parent 4a26a50dc5
commit e0967d1583

View File

@ -10,6 +10,9 @@ FACTORY = 'openSUSE:Factory'
STG_PREFIX = 'openSUSE:Factory:Staging:'
def _is_int(x):
return isinstance(x, int) or x.isdigit()
class RequestFinder:
def __init__(self, apiurl, stagingapi):
@ -31,9 +34,6 @@ class RequestFinder:
self.stagingapi = stagingapi
self.srs = {}
def _is_int(self, x):
return isinstance(x, int) or x.isdigit()
def _filter_review_by_project(self, element, state):
"""
Takes a XML that contains a list of reviews and take the ones
@ -64,7 +64,7 @@ class RequestFinder:
:param request_id: ID of the added request
"""
if not self._is_int(request_id):
if not _is_int(request_id):
return False
url = makeurl(self.apiurl, ['request', str(request_id)])
@ -191,7 +191,7 @@ class RequestFinder:
for p in pkgs:
found = False
for staging in self.stagingapi.get_staging_projects():
if self._is_int(p) and self.stagingapi.get_package_for_request_id(staging, p):
if _is_int(p) and self.stagingapi.get_package_for_request_id(staging, p):
self.srs[int(p)] = {'staging': staging}
found = True
continue