Skip to content

Commit

Permalink
add some comments explaining logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jchate6 committed Jan 24, 2025
1 parent 8188510 commit dfeaa3b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions simbad2k/simbad2k.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit dfeaa3b

Please sign in to comment.