Skip to content

Commit

Permalink
[Mellanox] Ensure concrete platform API classes call base class initi…
Browse files Browse the repository at this point in the history
…alizer (#6854)

In preparation for the merging of sonic-net/sonic-platform-common#173, which properly defines class and instance members in the Platform API base classes.

It is proper object-oriented methodology to call the base class initializer, even if it is only the default initializer. This also future-proofs the potential addition of custom initializers in the base classes down the road.
  • Loading branch information
jleveque authored Feb 25, 2021
1 parent 66e3e51 commit 516ff8b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ def is_non_onie_firmware_update_supported(self):

class Component(ComponentBase):
def __init__(self):
super(Component, self).__init__()
self.name = None
self.description = None
self.image_ext_name = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ def __init__(self, category, index, has_index, position, dependency = None):
"""
index should be a string for category ambient and int for other categories
"""
super(Thermal, self).__init__()
if category == THERMAL_DEV_CATEGORY_AMBIENT:
self.name = thermal_ambient_name[index]
self.index = index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(self, wd_device_path):
Open a watchdog handle
@param wd_device_path Path to watchdog device
"""
super(WatchdogImplBase, self).__init__()

self.watchdog_path = wd_device_path
self.watchdog = os.open(self.watchdog_path, os.O_WRONLY)
Expand Down

0 comments on commit 516ff8b

Please sign in to comment.