summaryrefslogtreecommitdiff
path: root/rdflib/tools
diff options
context:
space:
mode:
authorIwan Aucamp <aucampia@gmail.com>2023-04-12 22:11:02 +0200
committerGitHub <noreply@github.com>2023-04-12 22:11:02 +0200
commit4ea14367ffa2c05e5c288842982dcc3cdd194dd6 (patch)
tree4e82b7461510de574c5912af1a6e15d05ffc14ec /rdflib/tools
parent7df77cd3fa0381ae2b309981230eaa0d42e90b79 (diff)
downloadrdflib-4ea14367ffa2c05e5c288842982dcc3cdd194dd6.tar.gz
fix: eliminate bare `except:` (#2350)
Replace bare `except:` with `except Exception`, there are some cases where it can be narrowed further, but this is already an improvement over the current situation. This is somewhat pursuant to eliminating [flakeheaven](https://github.com/flakeheaven/flakeheaven), as it no longer supports the latest version of flake8 [[ref](https://github.com/flakeheaven/flakeheaven/issues/132)]. But it also is just the right thing to do as bare exceptions can cause problems.
Diffstat (limited to 'rdflib/tools')
-rw-r--r--rdflib/tools/csv2rdf.py2
-rw-r--r--rdflib/tools/rdf2dot.py4
-rw-r--r--rdflib/tools/rdfs2dot.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/rdflib/tools/csv2rdf.py b/rdflib/tools/csv2rdf.py
index 267483ed..fe740356 100644
--- a/rdflib/tools/csv2rdf.py
+++ b/rdflib/tools/csv2rdf.py
@@ -414,7 +414,7 @@ class CSV2RDF:
"%d rows, %d triples, elapsed %.2fs.\n"
% (rows, self.triples, time.time() - start)
)
- except:
+ except Exception:
sys.stderr.write("Error processing line: %d\n" % rows)
raise
diff --git a/rdflib/tools/rdf2dot.py b/rdflib/tools/rdf2dot.py
index 1a33ee26..0ca1fa1e 100644
--- a/rdflib/tools/rdf2dot.py
+++ b/rdflib/tools/rdf2dot.py
@@ -98,7 +98,7 @@ def rdf2dot(g, stream, opts={}):
return l_
try:
return g.namespace_manager.compute_qname(x)[2]
- except:
+ except Exception:
return x
def formatliteral(l, g):
@@ -113,7 +113,7 @@ def rdf2dot(g, stream, opts={}):
try:
q = g.compute_qname(x)
return q[0] + ":" + q[2]
- except:
+ except Exception:
return x
def color(p):
diff --git a/rdflib/tools/rdfs2dot.py b/rdflib/tools/rdfs2dot.py
index 69ecfba5..4e639b48 100644
--- a/rdflib/tools/rdfs2dot.py
+++ b/rdflib/tools/rdfs2dot.py
@@ -87,7 +87,7 @@ def rdfs2dot(g, stream, opts={}):
if lbl is None:
try:
lbl = grf.namespace_manager.compute_qname(xx)[2]
- except:
+ except Exception:
pass # bnodes and some weird URIs cannot be split
return lbl