From 6fb936509ea1ad7747c6418c3986144bfedc0da3 Mon Sep 17 00:00:00 2001 From: Aleksandra Apolinarska Date: Wed, 17 Apr 2024 16:16:32 +0200 Subject: [PATCH] #5 linter --- src/aixd_grasshopper/gh_ui_helper.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/aixd_grasshopper/gh_ui_helper.py b/src/aixd_grasshopper/gh_ui_helper.py index c42576a..509341d 100644 --- a/src/aixd_grasshopper/gh_ui_helper.py +++ b/src/aixd_grasshopper/gh_ui_helper.py @@ -1,5 +1,5 @@ import json -import urllib + import Grasshopper import urllib2 @@ -84,17 +84,19 @@ def clear_sticky(ghenv, st): # There might be other keys in the sticky dictionary, so we need to filter them out. for key in keys: + session_id = None + guid_str = None try: session_id = key.split("_")[0] guid_str = key.split("_")[1] - except: - session_id = None - guid_str = None + except Exception: + pass if not session_id or not guid_str: continue - # The retrieved session_id and guid_str may either come from a different Grasshopper document, or from some other process and be incorrect/meaningless. + # The retrieved session_id and guid_str may either come from a different Grasshopper document, + # or from some other process and be incorrect/meaningless. # In these cases, the following code will do nothing anyway. if session_id == ghdoc_id: reset_component(ghdoc, guid_str) @@ -103,7 +105,8 @@ def clear_sticky(ghenv, st): def reset_component(ghdoc, guid_str): """ - adapted from: https://github.com/compas-dev/compas/blob/ea4b5b5191a350d24cbb479c6770daa68dbe53fd/src/compas_ghpython/timer.py#L8 + adapted from: + https://github.com/compas-dev/compas/blob/ea4b5b5191a350d24cbb479c6770daa68dbe53fd/src/compas_ghpython/timer.py#L8 """ guid = Guid(guid_str)