[tor-commits] [ooni-probe/master] Rename input to inputunit

isis at torproject.org isis at torproject.org
Thu Oct 4 14:41:15 UTC 2012


commit 97935b7183cc6031ec1d524eaf873664fdb7c3d4
Author: Arturo Filastò <arturo at filasto.net>
Date:   Fri Sep 28 23:24:41 2012 +0000

    Rename input to inputunit
---
 ooni/input.py     |   65 -----------------------------------------------------
 ooni/inputunit.py |   65 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 ooni/oonicli.py   |    2 +-
 ooni/runner.py    |    2 +-
 4 files changed, 67 insertions(+), 67 deletions(-)

diff --git a/ooni/input.py b/ooni/input.py
deleted file mode 100644
index 69507b4..0000000
--- a/ooni/input.py
+++ /dev/null
@@ -1,65 +0,0 @@
-class InputUnitFactory(object):
-    """
-    This is a factory that takes the size of input units to be generated a set
-    of units that is a python iterable item and outputs InputUnit objects
-    containing inputUnitSize elements.
-
-    This object is a python iterable, this means that it does not need to keep
-    all the elements in memory to be able to produce InputUnits.
-    """
-    inputUnitSize = 3
-    def __init__(self, inputs=[]):
-        self._inputs = iter(inputs)
-        self._idx = 0
-        self._ended = False
-
-    def __iter__(self):
-        return self
-
-    def next(self):
-        if self._ended:
-            raise StopIteration
-
-        last_element_idx = self._idx + self.inputUnitSize
-        input_unit_elements = []
-        for i in xrange(last_element_idx):
-            try:
-                input_unit_elements.append(self._inputs.next())
-            except:
-                self._ended = True
-                break
-
-        self._idx += self.inputUnitSize
-
-        return InputUnit(input_unit_elements)
-
-
-class InputUnit(object):
-    """
-    This is a python iterable object that contains the input elements to be
-    passed onto a TestCase.
-    """
-    def __init__(self, inputs=[]):
-        self._inputs = iter(inputs)
-
-    def __repr__(self):
-        return "<%s inputs=%s>" % (self.__class__, self._inputs)
-
-    def __add__(self, inputs):
-        for input in inputs:
-            self._inputs.append(input)
-
-    def __iter__(self):
-        return self
-
-    def next(self):
-        try:
-            return self._inputs.next()
-        except:
-            raise StopIteration
-
-    def append(self, input):
-        self._inputs.append(input)
-
-
-
diff --git a/ooni/inputunit.py b/ooni/inputunit.py
new file mode 100644
index 0000000..69507b4
--- /dev/null
+++ b/ooni/inputunit.py
@@ -0,0 +1,65 @@
+class InputUnitFactory(object):
+    """
+    This is a factory that takes the size of input units to be generated a set
+    of units that is a python iterable item and outputs InputUnit objects
+    containing inputUnitSize elements.
+
+    This object is a python iterable, this means that it does not need to keep
+    all the elements in memory to be able to produce InputUnits.
+    """
+    inputUnitSize = 3
+    def __init__(self, inputs=[]):
+        self._inputs = iter(inputs)
+        self._idx = 0
+        self._ended = False
+
+    def __iter__(self):
+        return self
+
+    def next(self):
+        if self._ended:
+            raise StopIteration
+
+        last_element_idx = self._idx + self.inputUnitSize
+        input_unit_elements = []
+        for i in xrange(last_element_idx):
+            try:
+                input_unit_elements.append(self._inputs.next())
+            except:
+                self._ended = True
+                break
+
+        self._idx += self.inputUnitSize
+
+        return InputUnit(input_unit_elements)
+
+
+class InputUnit(object):
+    """
+    This is a python iterable object that contains the input elements to be
+    passed onto a TestCase.
+    """
+    def __init__(self, inputs=[]):
+        self._inputs = iter(inputs)
+
+    def __repr__(self):
+        return "<%s inputs=%s>" % (self.__class__, self._inputs)
+
+    def __add__(self, inputs):
+        for input in inputs:
+            self._inputs.append(input)
+
+    def __iter__(self):
+        return self
+
+    def next(self):
+        try:
+            return self._inputs.next()
+        except:
+            raise StopIteration
+
+    def append(self, input):
+        self._inputs.append(input)
+
+
+
diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index e5c990f..63edbe3 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -18,7 +18,7 @@ import sys, os, random, gc, time, warnings
 import unittest
 import inspect
 
-from ooni.input import InputUnitFactory
+from ooni.inputunit import InputUnitFactory
 from ooni.reporter import ReporterFactory
 from ooni.nettest import InputTestSuite
 from ooni.plugoo import tests
diff --git a/ooni/runner.py b/ooni/runner.py
index 13fdda2..7883f07 100644
--- a/ooni/runner.py
+++ b/ooni/runner.py
@@ -13,7 +13,7 @@ from twisted.trial.runner import isPackage, isTestCase, ErrorHolder
 from twisted.trial.runner import filenameToModule, _importFromFile
 
 from ooni.reporter import ReporterFactory
-from ooni.input import InputUnitFactory
+from ooni.inputunit import InputUnitFactory
 from ooni.nettest import InputTestSuite
 from ooni import nettest
 from ooni.utils import log





More information about the tor-commits mailing list