Skip to content

Commit

Permalink
removed BaseException and made BTD coherent
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Papior <[email protected]>
  • Loading branch information
zerothi committed Jan 15, 2025
1 parent b030984 commit 8508960
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/sisl/io/siesta/binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,7 @@ def func(atom_):
n[io, i_s] = orb.n
l[io, i_s] = orb.l
zeta[io, i_s] = orb.zeta

Check warning on line 1648 in src/sisl/io/siesta/binaries.py

View check run for this annotation

Codecov / codecov/patch

src/sisl/io/siesta/binaries.py#L1647-L1648

Added lines #L1647 - L1648 were not covered by tests
except:
except Exception:
pass # should we warn?

args.extend([n, l, zeta])
Expand Down
4 changes: 2 additions & 2 deletions src/sisl/io/siesta/stdout.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _parse_version(attr, instance, match):
version, *spec = opt.split("-", maxsplit=1)
try:
version = tuple(int(v) for v in version.split("."))
except BaseException:
except Exception:

Check warning on line 122 in src/sisl/io/siesta/stdout.py

View check run for this annotation

Codecov / codecov/patch

src/sisl/io/siesta/stdout.py#L122

Added line #L122 was not covered by tests
version = (0, 0, 0)

# Convert version to a tuple
Expand Down Expand Up @@ -1431,7 +1431,7 @@ def try_parse_int(s):
"Mulliken Atomic Populations",
"Mulliken Net Atomic Populations",
]
except BaseException:
except Exception:

Check notice

Code scanning / CodeQL

Empty except Note

'except' clause does nothing but pass and there is no explanatory comment.
pass

else:
Expand Down
9 changes: 8 additions & 1 deletion src/sisl_toolbox/btd/_btd.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,14 @@ def from_fdf(cls, fdf, prefix="TBT", use_tbt_se=False, eta=None):
is_tbtrans = prefix.upper() == "TBT"

# Read the device H, only valid for TBT stuff
Hdev = si.get_sile(fdf.get("TBT.HS", f"{slabel}.TSHS")).read_hamiltonian()
for hs_ext in ("TS.HSX", "TSHS", "HSX"):
if Path(f"{slabel}.{hs_ext}").exists():
# choose a sane default (if it exists!)
hs_default = f"{slabel}.{hs_ext}"
break
else:
hs_default = f"{slabel}.TSHS"
Hdev = si.get_sile(fdf.get("TBT.HS", hs_default)).read_hamiltonian()

def get_line(line):
"""Parse lines in the %block constructs of fdf's"""
Expand Down
2 changes: 1 addition & 1 deletion tools/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def get_pull_requests(repo, revision_range):

try:
prs.append(repo.get_pull(n))
except BaseException:
except Exception:
pass

return prs
Expand Down

0 comments on commit 8508960

Please sign in to comment.