From 5fed805777228403024d131fb189a1a1b2d53c34 Mon Sep 17 00:00:00 2001 From: James Troup Date: Fri, 27 Feb 2004 20:07:40 +0000 Subject: [PATCH] don't abuse .count(). remove a couple of unused variables. --- halle | 6 +++--- jenna | 8 ++++++-- jennifer | 8 ++++---- jeri | 6 +++--- katie.py | 11 +++++------ lisa | 10 +++++----- utils.py | 4 ++-- 7 files changed, 28 insertions(+), 25 deletions(-) diff --git a/halle b/halle index 079864a8..bf9e6fd5 100755 --- a/halle +++ b/halle @@ -1,8 +1,8 @@ #!/usr/bin/env python # Remove obsolete .changes files from proposed-updates -# Copyright (C) 2001, 2002, 2003 James Troup -# $Id: halle,v 1.10 2003-11-20 02:37:37 troup Exp $ +# Copyright (C) 2001, 2002, 2003, 2004 James Troup +# $Id: halle,v 1.11 2004-02-27 20:07:40 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -121,7 +121,7 @@ def check_joey (filename): if len(split_line) != 2: utils.fubar("Parse error (not exactly 2 elements): %s" % (line)); install_type = split_line[0]; - if [ "install", "install-u", "sync-install" ].count(install_type) == 0: + if install_type not in [ "install", "install-u", "sync-install" ]: utils.fubar("Unknown install type ('%s') from: %s" % (install_type, line)); changes_filename = split_line[1] if Options["debug"]: diff --git a/jenna b/jenna index e346e69b..dde4388d 100755 --- a/jenna +++ b/jenna @@ -2,7 +2,7 @@ # Generate file lists used by apt-ftparchive to generate Packages and Sources files # Copyright (C) 2000, 2001, 2002, 2003, 2004 James Troup -# $Id: jenna,v 1.26 2004-01-21 03:22:23 troup Exp $ +# $Id: jenna,v 1.27 2004-02-27 20:07:40 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -350,7 +350,11 @@ def stable_dislocation_p(): return 1; # Otherwise, look in what suites the user specified suites = Options["Suite"].split(); - return suites.count("stable"); + + if "stable" in suites: + return 1; + else: + return 0; ################################################################################ diff --git a/jennifer b/jennifer index 2cc353ba..2ba18ad0 100755 --- a/jennifer +++ b/jennifer @@ -1,8 +1,8 @@ #!/usr/bin/env python # Checks Debian packages from Incoming -# Copyright (C) 2000, 2001, 2002, 2003 James Troup -# $Id: jennifer,v 1.43 2003-11-07 01:48:58 troup Exp $ +# Copyright (C) 2000, 2001, 2002, 2003, 2004 James Troup +# $Id: jennifer,v 1.44 2004-02-27 20:07:40 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ re_valid_pkg_name = re.compile(r"^[\dA-Za-z][\dA-Za-z\+\-\.]+$"); ################################################################################ # Globals -jennifer_version = "$Revision: 1.43 $"; +jennifer_version = "$Revision: 1.44 $"; Cnf = None; Options = None; @@ -1007,7 +1007,7 @@ def process_it (changes_file): ############################################################################### def main(): - global Cnf, Options, Logger, nmu; + global Cnf, Options, Logger; changes_files = init(); diff --git a/jeri b/jeri index 6c7294f5..a0ad9e8b 100755 --- a/jeri +++ b/jeri @@ -1,8 +1,8 @@ #!/usr/bin/env python # Dependency check proposed-updates -# Copyright (C) 2001, 2002 James Troup -# $Id: jeri,v 1.11 2003-01-02 18:13:03 troup Exp $ +# Copyright (C) 2001, 2002, 2004 James Troup +# $Id: jeri,v 1.12 2004-02-27 20:07:40 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -236,7 +236,7 @@ def check_joey (filename): if len(split_line) != 2: utils.fubar("Parse error (not exactly 2 elements): %s" % (line)); install_type = split_line[0]; - if [ "install", "install-u", "sync-install" ].count(install_type) == 0: + if install_type not in [ "install", "install-u", "sync-install" ]: utils.fubar("Unknown install type ('%s') from: %s" % (install_type, line)); changes_filename = split_line[1] if Options["debug"]: diff --git a/katie.py b/katie.py index f5010152..776310dd 100644 --- a/katie.py +++ b/katie.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # Utility functions for katie -# Copyright (C) 2001, 2002, 2003 James Troup -# $Id: katie.py,v 1.43 2003-11-07 01:48:42 troup Exp $ +# Copyright (C) 2001, 2002, 2003, 2004 James Troup +# $Id: katie.py,v 1.44 2004-02-27 20:07:40 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -93,7 +93,6 @@ class Katie: def __init__(self, Cnf): self.Cnf = Cnf; - self.values = {}; # Read in the group-maint override file self.nmu = nmu_p(Cnf); self.accept_count = 0; @@ -646,17 +645,17 @@ distribution."""; ql = map(lambda x: x[0], q.getresult()); # Try (1) - if ql.count(source_version): + if source_version in ql: continue # Try (2) orig_source_version = re_bin_only_nmu_of_mu.sub('', source_version) - if ql.count(orig_source_version): + if orig_source_version in ql: continue # Try (3) orig_source_version = re_bin_only_nmu_of_nmu.sub('', source_version) - if ql.count(orig_source_version): + if orig_source_version in ql: continue # No source found... diff --git a/lisa b/lisa index 843ec2fb..858db179 100755 --- a/lisa +++ b/lisa @@ -1,8 +1,8 @@ #!/usr/bin/env python # Handles NEW and BYHAND packages -# Copyright (C) 2001, 2002, 2003 James Troup -# $Id: lisa,v 1.27 2004-01-29 23:18:47 dsilvers Exp $ +# Copyright (C) 2001, 2002, 2003, 2004 James Troup +# $Id: lisa,v 1.28 2004-02-27 20:07:40 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ import apt_pkg, apt_inst; import db_access, fernanda, katie, logging, utils; # Globals -lisa_version = "$Revision: 1.27 $"; +lisa_version = "$Revision: 1.28 $"; Cnf = None; Options = None; @@ -472,7 +472,7 @@ def edit_index (new, index): got_priority = 0; while not got_priority: new_priority = utils.our_raw_input("New priority: ").strip(); - if Priorities.priorities.count(new_priority) == 0: + if new_priority in Priorities.priorities: print "E: '%s' is not a valid priority, try again." % (new_priority); else: got_priority = 1; @@ -484,7 +484,7 @@ def edit_index (new, index): got_section = 0; while not got_section: new_section = utils.our_raw_input("New section: ").strip(); - if Sections.sections.count(new_section) == 0: + if new_section in Sections.sections: print "E: '%s' is not a valid section, try again." % (new_section); else: got_section = 1; diff --git a/utils.py b/utils.py index c2424cf7..9b3ab2a1 100644 --- a/utils.py +++ b/utils.py @@ -2,7 +2,7 @@ # Utility functions # Copyright (C) 2000, 2001, 2002, 2003, 2004 James Troup -# $Id: utils.py,v 1.62 2004-01-21 03:48:58 troup Exp $ +# $Id: utils.py,v 1.63 2004-02-27 20:07:40 troup Exp $ ################################################################################ @@ -93,7 +93,7 @@ def extract_component_from_section(section): if section.find('/') != -1: component = section.split('/')[0]; - if component.lower() == "non-us" and section.count('/') > 0: + if component.lower() == "non-us" and section.find('/') != -1: s = component + '/' + section.split('/')[1]; if Cnf.has_key("Component::%s" % s): # Avoid e.g. non-US/libs component = s; -- 2.39.5