nasa-jpl / sstmp

Solar System Treks Mosaic Pipeline
Apache License 2.0
12 stars 4 forks source link

Add type hints to find_stereo_pairs.py #27

Closed PicoJr closed 3 years ago

PicoJr commented 3 years ago

Add type hints to find_stereo_pairs.py

ghost commented 2 years ago

Ahum guys... I may be mistaken but isn't the json import used here (and in a few other places)? I guess Pycharm is confused by the import in the main function but it definitely crashes in my workflow:

Traceback (most recent call last):
  File "/nacpl/find_nacs_mono.py", line 57, in <module>
    clize.run(bounding_box_mono, alt=from_polygon)
  File "/opt/miniconda3/envs/nacpl_env/lib/python3.7/site-packages/sigtools/modifiers.py", line 158, in __call__
    return self.func(*args, **kwargs)
  File "/opt/miniconda3/envs/nacpl_env/lib/python3.7/site-packages/clize/runner.py", line 363, in run
    ret = cli(*args)
  File "/opt/miniconda3/envs/nacpl_env/lib/python3.7/site-packages/clize/runner.py", line 220, in __call__
    return func(*posargs, **kwargs)
  File "/nacpl/find_nacs_mono.py", line 26, in bounding_box_mono
    polygon=wkt.dumps(search_poly_shapely)
  File "/opt/miniconda3/envs/nacpl_env/lib/python3.7/site-packages/nacpl-0.1.0-py3.7.egg/nacpl/find_stereo_pairs.py", line 113, in __init__
    self.results = self._search_from_poly(*args, **kwargs)
  File "/opt/miniconda3/envs/nacpl_env/lib/python3.7/site-packages/nacpl-0.1.0-py3.7.egg/nacpl/find_stereo_pairs.py", line 131, in _search_from_poly
    count_resp = json.loads(count_resp.read())
NameError: name 'json' is not defined
foobarbecue commented 2 years ago

Um, whoops. Thanks.

PicoJr commented 2 years ago

I confirm I have the same issue running find_nacs_mono.py.

top import import json is indeed useful, it should not have been removed, sorry for the breakage.

I opened a PR that puts the import back.

foobarbecue commented 2 years ago

Looks like it might be time to write some unit tests ;-)