eMapR / lt-gee-py

Python interface to the Google Earth Engine implementation of the LandTrendr spectral-temporal segmentation algorithm.
Apache License 2.0
9 stars 1 forks source link

pytype complaints #2

Open schwehr opened 7 months ago

schwehr commented 7 months ago

@myscon, thanks for adding type annotations! The following is using the current head of main:

https://github.com/eMapR/lt-gee-py/commit/ffd7ee8c0749cba965ef3cf7c9272e8ea54ce9d6

Note that these errors come from a custom environment (google3) that uses bazel for building and pytype for checking the type annotations. I got these complaints:

File "third_party/py/ltgee/landtrendr.py", line 260, in _build_lt_collection: bad return type [bad-return-type]
           Expected: ee.imagecollection.ImageCollection
  Actually returned: ee.image.Image
File "third_party/py/ltgee/landtrendr.py", line 262, in _build_lt_collection: bad return type [bad-return-type]
           Expected: ee.imagecollection.ImageCollection
  Actually returned: ee.image.Image
File "third_party/py/ltgee/landtrendr.py", line 264, in _build_lt_collection: bad return type [bad-return-type]
           Expected: ee.imagecollection.ImageCollection
  Actually returned: ee.image.Image
File "third_party/py/ltgee/landtrendr.py", line 286, in LtCollection: Type annotation for prefix does not match type of assignment [annotation-type-mismatch]
  Annotation: str (Did you mean 'str | None'?)
  Assignment: None
File "third_party/py/ltgee/landtrendr.py", line 302, in LtCollection: Type annotation for prefix does not match type of assignment [annotation-type-mismatch]
  Annotation: str (Did you mean 'str | None'?)
  Assignment: None
File "third_party/py/ltgee/landtrendr.py", line 424, in _tc_reducer: Function LtCollection._reducer expects 2 arg(s), got 3 [wrong-arg-count]
         Expected: (image_collection, reducer)
  Actually passed: (image_collection, reducer, _)
File "third_party/py/ltgee/landtrendr.py", line 491, in _ensemble_reducer: Function LtCollection._reducer expects 2 arg(s), got 3 [wrong-arg-count]
         Expected: (image_collection, reducer)
  Actually passed: (image_collection, reducer, _)
File "third_party/py/ltgee/landtrendr.py", line 544, in _ensemble_reducer_alt: Function LtCollection._reducer expects 2 arg(s), got 3 [wrong-arg-count]
         Expected: (image_collection, reducer)
  Actually passed: (image_collection, reducer, _)
File "third_party/py/ltgee/landtrendr.py", line 595, in run_params: No attribute '_run_params' on LandTrendr [attribute-error]
File "third_party/py/ltgee/landtrendr.py", line 848, in get_segment_data: bad return type [bad-return-type]
           Expected: ee.image.Image
  Actually returned: None
File "third_party/py/ltgee/landtrendr.py", line 860, in get_segment_count: Function LandTrendr.get_segment_count was called with the wrong arguments [wrong-arg-types]
         Expected: (segment_data: ee.image.Image)
  Actually passed: (segment_data: LandTrendr)
myscon commented 7 months ago

I've added a staticmethod decorator. Let me know if it works!

schwehr commented 7 months ago

Still having lots of troubles. I will try to give it a closer look soon.

myscon commented 7 months ago

Let me know how else I can help! I added a new tag with some changes to separate the composite generation and LandTrendr usage.