Cleanup: use specific exception types where appropriate
This commit is contained in:
@@ -66,7 +66,7 @@ API_F_ARGS = 7
|
||||
def api_version():
|
||||
try:
|
||||
import bpy
|
||||
except:
|
||||
except ModuleNotFoundError:
|
||||
return None, None
|
||||
version = tuple(bpy.app.version[:2])
|
||||
version_key = "%d.%d" % (version[0], version[1])
|
||||
|
||||
@@ -152,7 +152,7 @@ def edge_face_count_dict(mesh):
|
||||
key = edges[loops[i].edge_index].key
|
||||
try:
|
||||
face_edge_count[key] += 1
|
||||
except:
|
||||
except KeyError:
|
||||
face_edge_count[key] = 1
|
||||
|
||||
return face_edge_count
|
||||
|
||||
@@ -645,7 +645,7 @@ def BuildRNAInfo():
|
||||
def base_id(rna_struct):
|
||||
try:
|
||||
return rna_struct.base.identifier
|
||||
except:
|
||||
except AttributeError:
|
||||
return "" # invalid id
|
||||
|
||||
# structs = [(base_id(rna_struct), rna_struct.identifier, rna_struct) for rna_struct in bpy.doc.structs.values()]
|
||||
|
||||
@@ -30,11 +30,7 @@ def main():
|
||||
rna_api_new = []
|
||||
|
||||
for key, val_orig in mod_to_dict.items():
|
||||
try:
|
||||
val_new = mod_from_dict.pop(key)
|
||||
except:
|
||||
# print("not found", key)
|
||||
val_new = val_orig
|
||||
val_new = mod_from_dict.pop(key, val_orig)
|
||||
|
||||
# always take the class from the base
|
||||
val = list(val_orig)
|
||||
|
||||
@@ -119,7 +119,7 @@ for d in dir(bpy.types):
|
||||
t = getattr(bpy.types, d)
|
||||
try:
|
||||
r = t.bl_rna
|
||||
except:
|
||||
except AttributeError:
|
||||
r = None
|
||||
if r:
|
||||
seek(r, 'bpy.types.' + d + '.bl_rna', 0)
|
||||
|
||||
Reference in New Issue
Block a user