[Asterisk-code-review] Fix PEP8 findings. (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Wed Mar 8 07:27:11 CST 2017


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/5123 )

Change subject: Fix PEP8 findings.
......................................................................


Fix PEP8 findings.

Change-Id: I49e0920b0a212eaa475586f77dac45201bccec97
---
M lib/python/asterisk/ami.py
M lib/python/asterisk/sipp.py
2 files changed, 9 insertions(+), 5 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/lib/python/asterisk/ami.py b/lib/python/asterisk/ami.py
index abed882..9d991a0 100644
--- a/lib/python/asterisk/ami.py
+++ b/lib/python/asterisk/ami.py
@@ -42,6 +42,10 @@
         self.action = instance_config['action'] if 'action' in instance_config else 'none'
         self.config = instance_config
         self.passed = True
+        # Todo: _registered doesn't work if this object is to be used for
+        # multiple ami ids (Declaring "id: '0,1'") because the registerEvent
+        # needs to be done for each ami.  Admittedly it is kind of silly to
+        # use one object to deal with more than one ami instance.
         self._registered = False
         self._event_observers = []
         self.count = {}
@@ -186,8 +190,8 @@
         This will check against event counts and the like and then call into
         overridden versions via check_result
         """
-        if (self.count['event'] > self.count['max']
-                or self.count['event'] < self.count['min']):
+        if (self.count['event'] > self.count['max'] or
+                self.count['event'] < self.count['min']):
             LOGGER.warning("Event occurred %d times, which is out of the"
                            " allowable range", self.count['event'])
             LOGGER.warning("Event description: %s", str(self.config))
diff --git a/lib/python/asterisk/sipp.py b/lib/python/asterisk/sipp.py
index 59aa54b..e6e8fbb 100644
--- a/lib/python/asterisk/sipp.py
+++ b/lib/python/asterisk/sipp.py
@@ -215,8 +215,8 @@
             # each set of scenarios in the YAML config
             sipp_scenarios = []
             for scenario in scenario_set:
-                if ("coordinated-sender" in scenario
-                        and "coordinated-receiver" in scenario):
+                if ("coordinated-sender" in scenario and
+                        "coordinated-receiver" in scenario):
                     sipp_scenarios.append(CoordinatedScenario(self.test_name,
                                                               scenario))
                 else:
@@ -875,7 +875,7 @@
         for scenario_def in self.scenarios:
             default_port = 5060 + i + 1
             i += 1
-            if not '-p' in scenario_def:
+            if '-p' not in scenario_def:
                 scenario_def['-p'] = str(default_port)
             scenario = SIPpScenario(self.test_dir, scenario_def)
             self._scenario_objects.append(scenario)

-- 
To view, visit https://gerrit.asterisk.org/5123
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I49e0920b0a212eaa475586f77dac45201bccec97
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list