Skip to content

Commit 4f09669

Browse files
committed
Remove unnecessary try-except
With the paths now properly checked, we don't need a try block anymore.
1 parent a59f8da commit 4f09669

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

openpmd_validator/check_h5.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -575,10 +575,7 @@ def check_meshes(f, iteration, v, extensionStates):
575575
"does not exist in file!".format(full_meshes_path))
576576
return( np.array([1, 0]) )
577577
# Find all the meshes
578-
try:
579-
list_meshes = list(f[full_meshes_path].keys())
580-
except KeyError:
581-
list_meshes = []
578+
list_meshes = list(f[full_meshes_path].keys())
582579
print( "Iteration %s : found %d meshes"
583580
%( iteration, len(list_meshes) ) )
584581
else:
@@ -741,10 +738,7 @@ def check_particles(f, iteration, v, extensionStates) :
741738
full_particle_path))
742739
return(np.array([1, 0]))
743740
# Find all the particle species
744-
try:
745-
list_species = list(f[full_particle_path].keys())
746-
except KeyError:
747-
list_species = []
741+
list_species = list(f[full_particle_path].keys())
748742
else:
749743
list_species = []
750744

@@ -754,7 +748,7 @@ def check_particles(f, iteration, v, extensionStates) :
754748
# Go through all the particle species
755749
for species_name in list_species :
756750
species = f[full_particle_path + species_name.encode('ascii')]
757-
751+
758752
# Check all records for this species
759753
for species_record_name in species :
760754
result_array += test_record(species, species_record_name)

0 commit comments

Comments
 (0)