Skip to content
Snippets Groups Projects

Resolve "Migration guide pyotb 1.5.4 --> 2.0.0"

Merged Rémi Cresson requested to merge 104-migration into develop
All threads resolved!
1 file
+ 10
14
Compare changes
  • Side-by-side
  • Inline
+ 10
14
@@ -430,34 +430,30 @@ class OTBObject(ABC):
"`App.app` can be used to call otbApplications methods. "
)
if item[0].isupper():
if item in dir(self.app):
# Because otbApplication instances methods names start with an
# upper case
note += (
f"Maybe try `pyotb_app.app.{item}` instead of "
f"`pyotb_app.{item}`? "
)
if item.startswith("GetParameter"):
note += (
"Note: `pyotb_app.app.GetParameterValue('paramname')` can be "
"shorten with `pyotb_app['paramname']` to access parameters "
"values."
)
if item[0].islower():
elif item in self.parameters_keys:
# Because in pyotb 1.5.4, applications outputs were added as
# attributes of the instance
note += (
"Note: `pyotb_app.paramname` is no longer supported. Starting "
"from pytob 2.0.0, `pyotb_app['paramname']` can be used to "
"from pyotb 2.0.0, `pyotb_app['paramname']` can be used to "
"access parameters values. "
)
if item.startswith("GetParameter"):
note += (
"Note: `pyotb_app.app.GetParameterValue('paramname')` can be "
"shorten with `pyotb_app['paramname']` to access parameters "
"values."
)
depreciation_warning(note)
raise AttributeError
raise AttributeError(f"'{type(self)}' object has no attribute '{item}'")
def __getitem__(self, key) -> Any | list[float] | float | Slicer:
"""Override the default __getitem__ behaviour.
Loading