OSOceanAcoustics / echoregions

Interfacing water column sonar data with annotations and labels
https://echoregions.readthedocs.io/
Apache License 2.0
6 stars 6 forks source link

Fix type checkings to `isinstance` #120

Closed lsetiawan closed 1 year ago

lsetiawan commented 1 year ago

Overview

There are pieces of the code that does type comparison using type(blah) == mytype. This now seem to fail during pre-commit.ci as seen in PR https://github.com/OSOceanAcoustics/echoregions/pull/119. The better solution when comparing type, use isinstance(blah, mytype).

Places with errors

https://github.com/OSOceanAcoustics/echoregions/blob/25a451851a17b131a9112b2bca850ba0340d4cea/echoregions/regions2d/regions2d.py#L413-L419

https://github.com/OSOceanAcoustics/echoregions/blob/25a451851a17b131a9112b2bca850ba0340d4cea/echoregions/tests/test_r2d.py#L32-L37

ctuguinay commented 1 year ago

Thanks for spotting this! @lsetiawan, will add this to my testing PR.