From patchwork Wed Jun 28 08:46:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 781500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3wyGfl11bVz9s82; Wed, 28 Jun 2017 18:48:47 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical-com.20150623.gappssmtp.com header.i=@canonical-com.20150623.gappssmtp.com header.b="kQSNVkR0"; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1dQ8eR-0005XR-Hh; Wed, 28 Jun 2017 08:48:43 +0000 Received: from mail-wm0-f52.google.com ([74.125.82.52]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1dQ8eM-0005WJ-Kx for kernel-team@lists.ubuntu.com; Wed, 28 Jun 2017 08:48:38 +0000 Received: by mail-wm0-f52.google.com with SMTP id w126so46342052wme.0 for ; Wed, 28 Jun 2017 01:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=t/IzNqGa5ub3/FzLcMlrOljMgQhwRBGeuo6TMFBY12A=; b=kQSNVkR0s+ATlG9mzYLzYX7w1LY4nkdPxgvC6helPIyfPl5a82Mpt54Jcgx62ZVp6H r8SUixLsp2gulo/riUjaubLi/rsx9F7E6/oHcjFioMWiPucwoqhPBKk+ErwsHxSuy7/U eZia2hlgJHf5L9G5DDAnJT+RLLzLU0DFlUb3xTw+Ls6ZCS7Ppw1aWI8dW/Plh7Vhtxax KQEe+iYD+RMWYg7iPvgc6+sYLK07umKDC7BIRBowsctAP75y+YnD7qYC5REJ1bmHHKPK c6LYmETGu+xfpv5wcILMgVqBwnTJjW+oxsNlJtP+2q7gA5sEjhZkQZjvkH7k0JH9NGAu nMQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=t/IzNqGa5ub3/FzLcMlrOljMgQhwRBGeuo6TMFBY12A=; b=qVQ6uTSnWA0IftsbreA499jV57sMoJqiFKbr5MdosT2QoDncLSu4XWJJIGJPOWyMG+ UV678/S2drBtcOYfcUUUxqjiJd0gcNGI98FqRipUWv8XpXC7ypyUoN6jRNQPfeRZwwgJ cwyj7rDvlyHvGc+Ov9PzD8U3mWmAVLNTLta9T0XAtMlaZOk9upr1nhaw0at9ImNWAfWg SQfh1y25aOLMBeO+LnXIrkjsgCTt/Del8ExsrzU75cqtodrQJ+9sr7QZ88VLhyyZtG/F lQK54n500KOlbG409ii6p5x17Gnzbfyy5t0fCTWAQziePgutu+bly2Tdn9EKVVP9eEPM iTyQ== X-Gm-Message-State: AKS2vOwr/Y2vkhhJkoScuRByRmchA4eE2B4/VKfj1FBQDeoC/0HlF608 XtTIslVxrpA8emlyBWDWOw== X-Received: by 10.80.160.231 with SMTP id 94mr6899226edo.173.1498639717914; Wed, 28 Jun 2017 01:48:37 -0700 (PDT) Received: from localhost.localdomain (adsl-84-226-232-98.adslplus.ch. [84.226.232.98]) by smtp.gmail.com with ESMTPSA id j43sm760784ede.18.2017.06.28.01.48.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Jun 2017 01:48:37 -0700 (PDT) From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [kteam-tools 1/5] [link-to-tracker] Cleanups: replace variable 's' with 'self' Date: Wed, 28 Jun 2017 10:46:28 +0200 Message-Id: <20170628084632.17804-2-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170628084632.17804-1-juerg.haefliger@canonical.com> References: <20170628084632.17804-1-juerg.haefliger@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com Non-functional changes to fix the following pylint issues: - Method should have "self" as first argument (no-self-argument) - Invalid argument name "s" (invalid-name) Signed-off-by: Juerg Haefliger --- stable/link-to-tracker | 78 +++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/stable/link-to-tracker b/stable/link-to-tracker index d3d84a4b867b..780c252d4827 100755 --- a/stable/link-to-tracker +++ b/stable/link-to-tracker @@ -28,46 +28,46 @@ class WorkflowBugTask(object): # __init__ # - def __init__(s, lp_task, task_name): - s.__status = None - s.__assignee = None - setattr(s, 'name', task_name) - setattr(s, 'importance', lp_task.importance) - setattr(s, 'lp_task', lp_task) - s.__modified = False - s.bug = lp_task.bug + def __init__(self, lp_task, task_name): + self.__status = None + self.__assignee = None + setattr(self, 'name', task_name) + setattr(self, 'importance', lp_task.importance) + setattr(self, 'lp_task', lp_task) + self.__modified = False + self.bug = lp_task.bug # status # @property - def status(s): + def status(self): ''' Property: Gets the status for the task. ''' - if s.__status is None: - s.__status = s.lp_task.status - return s.__status + if self.__status is None: + self.__status = self.lp_task.status + return self.__status # assignee # @property - def assignee(s): + def assignee(self): ''' Property: Gets the assignee for the task. ''' - if s.__assignee is None: - assignee = s.lp_task.assignee + if self.__assignee is None: + assignee = self.lp_task.assignee if assignee is None: - s.__assignee = '*Unassigned' + self.__assignee = '*Unassigned' else: - s.__assignee = assignee.display_name - return s.__assignee + self.__assignee = assignee.display_name + return self.__assignee # modified # @property - def modified(s): - return s.__modified + def modified(self): + return self.__modified # Tracking # @@ -76,16 +76,16 @@ class Tracking(): ''' # __init__ # - def __init__(s, args): - s.args = args - s.launchpad = Launchpad('start-sru-cycle').service - s.project_tracked = 'kernel-sru-workflow' + def __init__(self, args): + self.args = args + self.launchpad = Launchpad('start-sru-cycle').service + self.project_tracked = 'kernel-sru-workflow' - def trackers(s, project): + def trackers(self, project): ''' Return a list of all the tracking bugs that need to be processed. ''' - center(s.__class__.__name__ + '.trackers') + center(self.__class__.__name__ + '.trackers') retval = {} @@ -98,7 +98,7 @@ class Tracking(): # The tracking bugs that we are interested in should have been created recently (days). # search_since = datetime.utcnow() - timedelta(days=30) - lp_project = s.launchpad.projects[project] + lp_project = self.launchpad.projects[project] tasks = lp_project.searchTasks(status=search_status, tags=search_tags, tags_combinator=search_tags_combinator, modified_since=search_since) for task in tasks: @@ -106,11 +106,11 @@ class Tracking(): cdebug(' LP: #%s - %s' % (bug.id, bug.title)) retval[bug.id] = bug.title - cleave(s.__class__.__name__ + '.trackers') + cleave(self.__class__.__name__ + '.trackers') return retval @property - def repo_info(s): + def repo_info(self): # Check: Are we currently in a git repository? # if not Git.is_repo(): @@ -125,35 +125,35 @@ class Tracking(): # create_tasks_by_name_mapping # - def create_tasks_by_name_mapping(s, bugid, project): + def create_tasks_by_name_mapping(self, bugid, project): ''' We are only interested in the tasks that are specific to the workflow project. Others are ignored. ''' - center(s.__class__.__name__ + '.create_tasks_by_name_mapping') + center(self.__class__.__name__ + '.create_tasks_by_name_mapping') tasks_by_name = {} cdebug(' Scanning bug tasks:', 'cyan') - lpbug = s.launchpad.bugs[bugid] + lpbug = self.launchpad.bugs[bugid] for task in lpbug.bug_tasks: task_name = task.bug_target_name # task_name = task.bug_target_name.replace(project, '').replace('/', '').split(' ', 1)[0] task_name = task.bug_target_name.replace(project, '').replace('/', '') tasks_by_name[task_name] = WorkflowBugTask(task, task_name) - cleave(s.__class__.__name__ + '.create_tasks_by_name_mapping') + cleave(self.__class__.__name__ + '.create_tasks_by_name_mapping') return tasks_by_name # main # - def main(s): + def main(self): retval = 1 try: - target_package, target_series = s.repo_info + target_package, target_series = self.repo_info found = False - for bugid in s.trackers(s.project_tracked): - tasks_by_name = s.create_tasks_by_name_mapping(bugid, s.project_tracked) + for bugid in self.trackers(self.project_tracked): + tasks_by_name = self.create_tasks_by_name_mapping(bugid, self.project_tracked) if '%s (Ubuntu %s)' % (target_package, target_series.title()) in tasks_by_name: found = True break @@ -181,13 +181,13 @@ class Tracking(): f.write(line) retval = 0 - lpbug = s.launchpad.bugs[bugid] + lpbug = self.launchpad.bugs[bugid] lpbug.title = title lpbug.lp_save() task = tasks_by_name['prepare-package'].lp_task task.status = "In Progress" - task.assignee = s.launchpad.me + task.assignee = self.launchpad.me task.lp_save() # Handle the user presses .