Re: [PATCH] Convert string.find calls into something modern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks,

Applied to my local tree, will get pushed to master shortly.

Regards,

Hans

On 11/08/2009 11:42 PM, Jesse Keating wrote:
string.find('foo') != -1 is a bit klunky.  We now have the ability to
just do 'foo' in string and get back a True or False from that.  I'm
sure there are more files in anaconda that could use this treatment but
this is the file I was looking at anyway.
---
  yuminstall.py |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/yuminstall.py b/yuminstall.py
index 0eb428a..76c7f64 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -557,13 +557,13 @@ class AnacondaYum(YumSorter):
          repo.yumvar.update(self.conf.yumvar)
          repo.cfg = parser

-        if repo.id.find("-source") != -1 or repo.id.find("-debuginfo") != -1:
+        if "-source" in repo.id or "-debuginfo" in repo.id:
              name = repo.name
              del(repo)
              raise RepoError, "Repo %s contains -source or -debuginfo, excluding" % name

          # this is a little hard-coded, but it's effective
-        if not BETANAG and (repo.id.find("rawhide") or repo.id.find("development")):
+        if not BETANAG and ("rawhide" in repo.id or "development" in repo.id):
              name = repo.name
              del(repo)
              raise RepoError, "Excluding devel repo %s for non-devel anaconda" % name
@@ -1547,7 +1547,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
                      supportedUpgradeVersion = 1
                      break

-        if productName.find("Red Hat Enterprise Linux") == -1:
+        if "Red Hat Enterprise Linux" not in productName:
              supportedUpgradeVersion = 1

          if supportedUpgradeVersion == 0:

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux