Open saransh13 opened 3 weeks ago
Hello @saransh13! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:
hexrd/material/material.py
:Line 724:13: E722 do not use bare 'except'
@psavery it seems like PEP8 is not happy with the bare except. Do you know of a better way to handle this part of the code?
It wants you to specify the type of exception. In this case, it should only ever raise a ValueError
, so you could do except ValueError:
.
If you want to catch every possible exception, you can still do except Exception:
, which catches them all.
This may be a bit cleaner, if I am understanding the use case well enough:
occ = []
for p in cifdata[occ_U[0]]:
v = p.split('(')[0]
occ.append(np.float64(v) if v.isnumeric() else 1.0)
atompos.append(np.asarray(occ))
Same as description.