Skip to content

Output fixes, str vs repr, exceptions and type hints

Cresson Remi requested to merge fixes into develop

Sorry, a big diff for many changes, but they were all linked 😅

  • Do not setattr(self, parameter) on App obj anymore
  • Refac save_objects and data - fixes #75 #72 (closed)
  • Using save_objects, App.parameters (and summarize()) is now correctly in sync with otb.Application parameters
  • Move summarize() back to App
  • Fix bugs with Output, __getitem__ in OTBObject and Output[slice], summarize() call parent pyotb app.
  • Add App.outputs to access Output objects via App[param_key] (see __getitem__)
  • Rename key_input and key_input_image to input_key and input_image_key
  • Raise TypeError when get_first_key failed, fixes #71 (closed)
  • Rename write() arg filename_extension to ext_fname, fixes #77 (closed) and error when "?" is not passed: add missing "?&"
  • Add App.output_key
  • Remove App.image_dic : fixes #79 (closed)
  • Type hints
  • Update tests, move data dicts to tests_data
  • Use __repr__ in OTBObject so user is free to implement __str__, add missing hash and id dunder methods
  • Merge summarize tests in test_core, and move summaries data to json file

The diff is positive because of test json data for summarize() - output is now far bigger, since App.parameters is really in sync with otb.Application instance.

TODOs from Remi's comments

  • TBD: Path and local files stuff removal (my thought) or at least disabled when using /vsi prefix
  • Add tests for the improved getitem behavior
  • Keep using otbApplication's enums for pixel types, parameter types, ...
  • Fix summarize (back to same state than in current develop branch)
Edited by Cresson Remi

Merge request reports