Message ID | 20170628084632.17804-2-juerg.haefliger@canonical.com |
---|---|
State | New |
Headers | show |
's' is used in place of 'self' by all the code I write. If you are going to be making this change we are going to have a lot of churn in our code. On Wed, Jun 28, 2017 at 10:46:28AM +0200, Juerg Haefliger wrote: > 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 <juerg.haefliger@canonical.com> > --- > 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 <ctrl-C>. > -- > 2.11.0 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team
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 <ctrl-C>.
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 <juerg.haefliger@canonical.com> --- stable/link-to-tracker | 78 +++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 39 deletions(-)