Commits

Sergey Astanin committed 8375edb

auto-remove trailing whitespace

Comments (0)

Files changed (3)

 
         if headers == "keys":
             headers = list(map(_text_type,keys))  # headers should be strings
+
     else:  # it's a usual an iterable of iterables, or a NumPy array
         rows = list(tabular_data)
-        
-        if (headers == "keys" and 
-            hasattr(tabular_data, "dtype") and 
+
+        if (headers == "keys" and
+            hasattr(tabular_data, "dtype") and
             getattr(tabular_data.dtype, "names")):
             # numpy record array
-            headers = tabular_data.dtype.names        
-        elif (headers == "keys" 
-              and len(rows) > 0 
-              and isinstance(rows[0], tuple) 
+            headers = tabular_data.dtype.names
+        elif (headers == "keys"
+              and len(rows) > 0
+              and isinstance(rows[0], tuple)
               and hasattr(rows[0], "_fields")): # namedtuple
             headers = list(map(_text_type, rows[0]._fields))
         elif headers == "keys" and len(rows) > 0:  # keys are column indices
     "Printing a two-dimensional NumPy record array without header"
     try:
         import numpy
-        na = numpy.asarray([("Alice", 23, 169.5), 
-                            ("Bob", 27, 175.0)], 
-                           dtype={"names":["name","age","height"], 
+        na = numpy.asarray([("Alice", 23, 169.5),
+                            ("Bob", 27, 175.0)],
+                           dtype={"names":["name","age","height"],
                                   "formats":["a32","uint8","f32"]})
         expected = "\n".join([ "-----  --  -----",
                                "Alice  23  169.5",
     except ImportError:
         print("test_numpy_2d_keys is skipped")
         pass   # this test is optional
-    
-    
+
+
 def test_numpy_record_array_keys():
     "Printing a two-dimensional NumPy record array with headers from fields"
     try:
         import numpy
-        na = numpy.asarray([("Alice", 23, 169.5), 
-                            ("Bob", 27, 175.0)], 
-                           dtype={"names":["name","age","height"], 
+        na = numpy.asarray([("Alice", 23, 169.5),
+                            ("Bob", 27, 175.0)],
+                           dtype={"names":["name","age","height"],
                                   "formats":["a32","uint8","f32"]})
         expected = "\n".join([ "name      age    height",
                                "------  -----  --------",
     except ImportError:
         print("test_numpy_2d_keys is skipped")
         pass   # this test is optional
-    
+
 def test_numpy_record_array_headers():
     "Printing a two-dimensional NumPy record array with user-supplied headers"
     try:
         import numpy
-        na = numpy.asarray([("Alice", 23, 169.5), 
-                            ("Bob", 27, 175.0)], 
-                           dtype={"names":["name","age","height"], 
+        na = numpy.asarray([("Alice", 23, 169.5),
+                            ("Bob", 27, 175.0)],
+                           dtype={"names":["name","age","height"],
                                   "formats":["a32","uint8","f32"]})
         expected = "\n".join([ "person      years     cm",
                                "--------  -------  -----",
     except ImportError:
         print("test_numpy_2d_keys is skipped")
         pass   # this test is optional
-    
+
 
 def test_pandas():
     "Printing a Pandas DataFrame."
         pass   # this test is optional
 
 
-def test_list_of_namedtuples(): 
-    "List of named tuples with field names as headers." 
+def test_list_of_namedtuples():
+    "List of named tuples with field names as headers."
     from collections import namedtuple
     NT = namedtuple("NT", ['foo', 'bar'])
     lt = [NT(1,2), NT(3,4)]
     print("Expected:\n%s\n" % expected)
     print("Got:\n%s\n" % result)
     assert expected == result
-    
-