From 997ba458ec53f764c6660bb681840f2740cd3d91 Mon Sep 17 00:00:00 2001
From: Campbell Barton <ideasman42@gmail.com>
Date: Thu, 22 Sep 2011 05:11:02 +0000
Subject: [PATCH] minor cleanup for x3d, dont use str as variable name and
 remove unneeded check

---
 io_mesh_ply/__init__.py    |  2 +-
 io_scene_x3d/export_x3d.py | 23 ++++++++---------------
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/io_mesh_ply/__init__.py b/io_mesh_ply/__init__.py
index ab245ed76..26d701a1d 100644
--- a/io_mesh_ply/__init__.py
+++ b/io_mesh_ply/__init__.py
@@ -80,7 +80,7 @@ class ImportPLY(bpy.types.Operator, ImportHelper):
 
 class ExportPLY(bpy.types.Operator, ExportHelper):
     '''Export a single object as a stanford PLY with normals, ''' \
-    '''colours and texture coordinates.'''
+    '''colours and texture coordinates'''
     bl_idname = "export_mesh.ply"
     bl_label = "Export PLY"
 
diff --git a/io_scene_x3d/export_x3d.py b/io_scene_x3d/export_x3d.py
index 1b8863a34..6152d9f2e 100644
--- a/io_scene_x3d/export_x3d.py
+++ b/io_scene_x3d/export_x3d.py
@@ -89,14 +89,14 @@ def suffix_quoted_str(value, suffix):
     return value[:-1] + suffix + value[-1:]
 
 
-def clean_def(str):
+def clean_def(txt):
     # see report [#28256]
-    if not str:
-        str = "None"
+    if not txt:
+        txt = "None"
     # no digit start
-    if str[0] in "1234567890+-":
-        str = "_" + str
-    return str.translate({  # control characters 0x0-0x1f
+    if txt[0] in "1234567890+-":
+        txt = "_" + txt
+    return txt.translate({  # control characters 0x0-0x1f
                             # 0x00: "_",
                           0x01: "_",
                           0x02: "_",
@@ -1439,16 +1439,9 @@ def save(operator, context, filepath="",
     if bpy.ops.object.mode_set.poll():
         bpy.ops.object.mode_set(mode='OBJECT')
 
-    file = None
     if use_compress:
-        try:
-            import gzip
-            file = gzip.open(filepath, 'w')
-        except:
-            print('failed to import compression modules, exporting uncompressed')
-            filepath = filepath[:-1]  # remove trailing z
-
-    if file is None:
+        file = gzip.open(filepath, 'w')
+    else:
         file = open(filepath, 'w')
 
     if global_matrix is None:
-- 
GitLab