From 941be0b806f8ade4aa84150b80940ce4ae5ccb7a Mon Sep 17 00:00:00 2001
From: Lionel GUEZ <guez@lmd.ens.fr>
Date: Mon, 4 Jul 2022 18:10:22 +0200
Subject: [PATCH] Check argument label in function `is_node_type`

---
 Overlap/plot_components.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Overlap/plot_components.py b/Overlap/plot_components.py
index da77c21a..ef2dcd8e 100755
--- a/Overlap/plot_components.py
+++ b/Overlap/plot_components.py
@@ -7,6 +7,7 @@ import numpy as np
 from matplotlib import patches
 import cartopy.crs as ccrs
 import report_graph
+import sys
 
 color_iter = itertools.cycle(('#1f77b4', '#aec7e8', '#ff7f0e',
                               '#ffbb78', '#2ca02c', '#98df8a',
@@ -40,6 +41,8 @@ def is_node_type(G, n, label):
                                               only_date = True) == label[1]
     elif label[0] == "node":
         return n in label[1]
+    else:
+        sys.exit(f"is_node_type: bad label: {label}")
 
 def plot_nbunch(G, nbunch, color = '#1f78b4', label = None, ax = None):
     if ax is None: ax = plt.gca()
@@ -96,7 +99,6 @@ def animate_nbunch(G, nbunch):
     
 if __name__ == "__main__":
     import argparse
-    import sys
     from os import path
     sys.path.append(path.join(sys.path[0], "../Common"))
     import util_eddies
-- 
GitLab