BIND 10 trac2222, updated. 87e52b48844ab6e51b2b7e811eae8d8913e4a982 [2222] used find() instead of `in` operator

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Sep 11 12:06:26 UTC 2012


The branch, trac2222 has been updated
       via  87e52b48844ab6e51b2b7e811eae8d8913e4a982 (commit)
      from  1231dd5b95fc8eaab5d1ada38334c5e20e9e8442 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 87e52b48844ab6e51b2b7e811eae8d8913e4a982
Author: Naoki Kambe <kambe at jprs.co.jp>
Date:   Tue Sep 11 20:28:00 2012 +0900

    [2222] used find() instead of `in` operator
    
     - used find() instead of `in` operator for exact pattern matching of string
     - a style fix in the list

-----------------------------------------------------------------------

Summary of changes:
 src/bin/xfrout/tests/xfrout_test.py.in |    3 ++-
 src/bin/xfrout/xfrout.py.in            |   11 ++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/xfrout/tests/xfrout_test.py.in b/src/bin/xfrout/tests/xfrout_test.py.in
index b471603..d9cb78f 100644
--- a/src/bin/xfrout/tests/xfrout_test.py.in
+++ b/src/bin/xfrout/tests/xfrout_test.py.in
@@ -321,7 +321,8 @@ class TestXfroutSessionBase(unittest.TestCase):
             'dec_axfr_running': _dec_axfr_running
             }
         self.get_counter = lambda n: \
-            self._statistics_data[n] if 'ixfr_' in n or 'axfr_' in n \
+            self._statistics_data[n] \
+            if n.find('ixfr_') == 0 or n.find('axfr_') == 0 \
             else self._statistics_data['zones'][TEST_ZONE_NAME_STR][n]
 
     def tearDown(self):
diff --git a/src/bin/xfrout/xfrout.py.in b/src/bin/xfrout/xfrout.py.in
index 48f967d..c7421f7 100755
--- a/src/bin/xfrout/xfrout.py.in
+++ b/src/bin/xfrout/xfrout.py.in
@@ -173,7 +173,8 @@ class XfroutSession():
         # incrementing or decrementing Xfr running. An argument
         # is required for zone name in counting Xfr requests.
         for (k, v) in counters.items():
-            if 'counter_' in k or 'inc_' in k or 'dec_' in k:
+            if k.find('counter_') == 0 or k.find('inc_') == 0 \
+                    or k.find('dec_') == 0:
                 setattr(self, "_%s" % k, lambda x: None)
                 if hasattr(v, '__call__'):
                     setattr(self, "_%s" % k, v)
@@ -976,10 +977,10 @@ class XfroutCounter:
         self._statistics_data = {}
         self._counters_for_xfroutsession = {}
         self._counters_for_notifyout = {}
-        self._xfrrunning_names = [ \
-            n for n in \
-                isc.config.spec_name_list(self._statistics_spec) \
-                if 'xfr_running' in n ]
+        self._xfrrunning_names = [
+            n for n in isc.config.spec_name_list\
+                (self._statistics_spec) \
+                if n.find('xfr_running') == 1 ]
         self._lock = threading.RLock()
         self._create_perzone_incrementers()
         self._create_xfrrunning_xxcrementers()



More information about the bind10-changes mailing list