Output fixes, str vs repr, exceptions and type hints
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)
Merge request reports
Activity
added 1 commit
- 3ac03d30 - STYE: linter
By Vincent Delbar on 2023-02-04T19:41:40 (imported from GitLab)
added 1 commit
- b198e991 - FIX: try to add "?&" to ext_fname test
By Vincent Delbar on 2023-02-04T20:29:19 (imported from GitLab)
added 1 commit
- d29d17c6 - FIX: force use of "?&" in ext_fname when "?" is missing
By Vincent Delbar on 2023-02-04T20:36:00 (imported from GitLab)
- Resolved by Cresson Remi
Now regarding the repr / str changes, here is the new behaviour :
In [1]: app Out[1]: <pyotb.BandMath object, id 1672876477320> In [8]: inp Out[8]: <pyotb.Input object, from tests\image.tif> In [14]: app["out"] Out[14]: <pyotb.Output object, id 1946345255176> In [15]: repr(app["out"]) Out[15]: '<pyotb.Output object, id 1946345255176>' In [18]: str(app["out"]) Out[18]: 'test.tif'
What do you think ? The idea is that the user is free to implement
__str__
when subclassing App or OTBObject, but repr is used by default for str when__str__
is not defined.By Vincent Delbar on 2023-02-05T18:49:43 (imported from GitLab)
Edited by Cresson Remi
added 1 commit
- bdbefb2b - STYLE: identation
By Vincent Delbar on 2023-02-04T20:51:45 (imported from GitLab)