[Liblas-commits] hg: satisfy the PEP 8 gods

liblas-commits at liblas.org liblas-commits at liblas.org
Tue May 11 11:43:33 EDT 2010


changeset efa1e69f369b in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=efa1e69f369b
summary: satisfy the PEP 8 gods

diffstat:

 python/liblas/__init__.py |    2 +-
 python/liblas/color.py    |   80 ++++---
 python/liblas/core.py     |  154 +++++++++-----
 python/liblas/file.py     |  261 ++++++++++++++----------
 python/liblas/format.py   |  123 ++++++-----
 python/liblas/guid.py     |   75 +++---
 python/liblas/header.py   |  474 ++++++++++++++++++++++++++-------------------
 python/liblas/point.py    |  370 +++++++++++++++++++++--------------
 python/liblas/srs.py      |  111 +++++----
 python/liblas/vlr.py      |   75 +++---
 10 files changed, 998 insertions(+), 727 deletions(-)

diffs (truncated from 3135 to 300 lines):

diff -r b0e958797e3e -r efa1e69f369b python/liblas/__init__.py
--- a/python/liblas/__init__.py	Fri May 07 10:53:37 2010 -0500
+++ b/python/liblas/__init__.py	Tue May 11 10:43:22 2010 -0500
@@ -15,4 +15,4 @@
 import header
 import vlr
 import color
-import srs    
\ No newline at end of file
+import srs
diff -r b0e958797e3e -r efa1e69f369b python/liblas/color.py
--- a/python/liblas/color.py	Fri May 07 10:53:37 2010 -0500
+++ b/python/liblas/color.py	Tue May 11 10:43:22 2010 -0500
@@ -10,39 +10,40 @@
  * Copyright (c) 2009, Howard Butler
  *
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following
  * conditions are met:
- * 
- *     * Redistributions of source code must retain the above copyright 
+ *
+ *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided 
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided
  *       with the distribution.
- *     * Neither the name of the Martin Isenburg or Iowa Department 
- *       of Natural Resources nor the names of its contributors may be 
- *       used to endorse or promote products derived from this software 
+ *     * Neither the name of the Martin Isenburg or Iowa Department
+ *       of Natural Resources nor the names of its contributors may be
+ *       used to endorse or promote products derived from this software
  *       without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  ****************************************************************************/
  """
 import core
 import ctypes
 
+
 class Color(object):
     def __init__(self, red=0, green=0, blue=0, owned=True, handle=None):
         """
@@ -52,10 +53,11 @@
         :type green: integer
         :keyword blue: Blue value for the point
         :type blue: integer
-        :keyword owned: flag to denote whether or not the instance owns its shadow
+        :keyword owned: flag to denote whether or not the instance owns
+                        its shadow
         :type owned: boolean
         :keyword handle: raw ctypes object
-        
+
         >>> from liblas import color
         >>> c = color.Color()
         >>> c.red
@@ -72,33 +74,36 @@
         124
         >>> c.blue
         125
-          
+
         .. note::
-            RGB values should always be normalized to 16 bit values. For example,
-            when encoding an 8 bit per channel pixel, multiply each channel value
-            by 256 prior to storage in these fields. This normalization allows
-            color values from different camera bit depths to be accurately merged.
+            RGB values should always be normalized to 16 bit values. For
+            example, when encoding an 8 bit per channel pixel, multiply each
+            channel value by 256 prior to storage in these fields. This
+            normalization allows color values from different camera bit depths
+            to be accurately merged.
         """
         if handle:
             self.handle = handle
         else:
             self.handle = core.las.LASColor_Create()
-        
+
         if red:
             self.red = red
         if green:
             self.green = green
         if blue:
             self.blue = blue
-            
+
         self.owned = owned
+
     def __del__(self):
         if self.owned:
             if self.handle and core:
                 core.las.LASColor_Destroy(self.handle)
-    
+
     def get_red(self):
         return core.las.LASColor_GetRed(self.handle)
+
     def set_red(self, value):
         return core.las.LASColor_SetRed(self.handle, value)
     doc = "Red value of the color triple"
@@ -106,13 +111,15 @@
 
     def get_green(self):
         return core.las.LASColor_GetGreen(self.handle)
+
     def set_green(self, value):
         return core.las.LASColor_SetGreen(self.handle, value)
     doc = "Green value of the color triple"
     green = property(get_green, set_green, None, doc)
-    
+
     def get_blue(self):
         return core.las.LASColor_GetBlue(self.handle)
+
     def set_blue(self, value):
         return core.las.LASColor_SetBlue(self.handle, value)
     doc = "Blue value of the color triple"
@@ -120,13 +127,13 @@
 
     def __iter__(self):
         """Iterator support.  Values are returned in [R,G,B] order
-        
+
           >>> for i in c:
           ...     print i
           123
           124
           125
-  
+
           >>> list(c)
           [123, 124, 125]
         """
@@ -142,4 +149,3 @@
         if not b:
             b = True
             yield self.blue
-            
\ No newline at end of file
diff -r b0e958797e3e -r efa1e69f369b python/liblas/core.py
--- a/python/liblas/core.py	Fri May 07 10:53:37 2010 -0500
+++ b/python/liblas/core.py	Tue May 11 10:43:22 2010 -0500
@@ -7,45 +7,50 @@
  * Author:   Howard Butler, hobu.inc at gmail.com
  *
  ******************************************************************************
- * Copyright (c) 2008, Howard Butler
+ * Copyright (c) 2009, Howard Butler
  *
  * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following
  * conditions are met:
- * 
- *     * Redistributions of source code must retain the above copyright 
+ *
+ *     * Redistributions of source code must retain the above copyright
  *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright 
- *       notice, this list of conditions and the following disclaimer in 
- *       the documentation and/or other materials provided 
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided
  *       with the distribution.
- *     * Neither the name of the Martin Isenburg or Iowa Department 
- *       of Natural Resources nor the names of its contributors may be 
- *       used to endorse or promote products derived from this software 
+ *     * Neither the name of the Martin Isenburg or Iowa Department
+ *       of Natural Resources nor the names of its contributors may be
+ *       used to endorse or promote products derived from this software
  *       without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  * OF SUCH DAMAGE.
  ****************************************************************************/
  """
-import atexit, os, re, sys
+
+import atexit
+import os
+import re
+import sys
 import ctypes
 from ctypes.util import find_library
 
 from ctypes import PyDLL
 
+
 class LASException(Exception):
     "libLAS exception, indicates a libLAS-related error."
     pass
@@ -54,56 +59,65 @@
 def check_return(result, func, cargs):
     "Error checking for LASError calls"
     if result != 0:
-        msg = 'LASError in "%s": %s' % (func.__name__, las.LASError_GetLastErrorMsg() )
+        msg = 'LASError in "%s": %s' % (func.__name__,
+                                        las.LASError_GetLastErrorMsg())
         las.LASError_Reset()
         raise LASException(msg)
     return True
 
+
 def check_void(result, func, cargs):
     "Error checking for void* returns"
     if not bool(result):
-        msg = 'LASError in "%s": %s' % (func.__name__, las.LASError_GetLastErrorMsg() )
+        msg = 'LASError in "%s": %s' % (func.__name__,
+                                        las.LASError_GetLastErrorMsg())
         las.LASError_Reset()
         raise LASException(msg)
     return result
 
+
 def check_void_done(result, func, cargs):
     "Error checking for void* returns that might be empty with no error"
     if las.LASError_GetErrorCount():
-        msg = 'LASError in "%s": %s' % (func.__name__, las.LASError_GetLastErrorMsg() )
+        msg = 'LASError in "%s": %s' % (func.__name__,
+                                        las.LASError_GetLastErrorMsg())
         las.LASError_Reset()
         raise LASException(msg)
-        
+
     return result
 
+
 def check_value(result, func, cargs):
     "Error checking proper value returns"
     count = las.LASError_GetErrorCount()
     if count != 0:
-        msg = 'LASError in "%s": %s' % (func.__name__, las.LASError_GetLastErrorMsg() )
+        msg = 'LASError in "%s": %s' % (func.__name__,
+                                        las.LASError_GetLastErrorMsg())
         las.LASError_Reset()
         raise LASException(msg)
     return result


More information about the Liblas-commits mailing list