openhab-scripters / openhab-helper-libraries

Scripts and modules for use with openHAB
Eclipse Public License 1.0
88 stars 69 forks source link

core.metadata get_metadata duplicate lines of code #319

Closed jimtng closed 4 years ago

jimtng commented 4 years ago

In https://github.com/openhab-scripters/openhab-helper-libraries/blob/master/Core/automation/lib/python/core/metadata.py the function get_metadata line 71-72,

    metadata = metadata_registry.get(MetadataKey(namespace, item_name))
    return metadata_registry.get(MetadataKey(namespace, item_name))

Why the duplication?

5iver commented 4 years ago

Thank you for pointing this out. Take a look here...

https://github.com/openhab-scripters/openhab-helper-libraries/commit/dca5e5d22b1ee4ecbabb53b3293230960ca0a190#r39583902

I'd removed some unnecessary commented out code in the last commit to core.metadata.py and this line should have been removed too. This wouldn't break anything, but there is no need to call the MetadataRegistry twice. I committed this change a long while ago and it will be included in a PR later this week. I have a lot to get pushed!

5iver commented 4 years ago

I squeaked this into #327.