From dfeaa3b41166201003d24c6df2358d3edfd678d4 Mon Sep 17 00:00:00 2001 From: Joey Chatelain Date: Fri, 24 Jan 2025 13:53:03 -0800 Subject: [PATCH] add some comments explaining logic --- simbad2k/simbad2k.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/simbad2k/simbad2k.py b/simbad2k/simbad2k.py index ee0acd4..8a1258d 100755 --- a/simbad2k/simbad2k.py +++ b/simbad2k/simbad2k.py @@ -150,14 +150,17 @@ def get_primary_designation(self): if identifications.get('disambiguation_list'): for target in identifications['disambiguation_list']: if self.scheme_mapping[self.scheme] == 'asteroid': + # If the Target is an asteroid, then the PermID should be an integer try: return int(target['permid']), None except (ValueError, KeyError, TypeError): continue elif self.scheme_mapping[self.scheme] == 'comet': + # If the Target is a comet, then the PermID should contain a letter (P/C/I) perm_id = target.get('permid') if perm_id: try: + # If the PermID is an integer, then it is not a comet, so we keep looking int(target['permid']) continue except (ValueError, KeyError, TypeError):