duncan-r / SHIP

Simple Hydraulic model Interface for Python
MIT License
7 stars 6 forks source link

Update super calls #16

Open duncan-r opened 7 years ago

duncan-r commented 7 years ago

The majority of super class calls use the old style ClassName.method(self, *args, **kwargs) format. These need updating to super(ClassName, self).method(*args, **kwargs)

Note that the super().method(*args, **kwargs) can't be used because we need to maintain v2.7 compatibility.

duncan-r commented 7 years ago

Reopening to note that some more work is needed to complete this update.

Multiple inheritance args need more consideration to complete for tuflowfilepart.py, line 469 as noted in #18

class TuflowFile(TuflowPart, PathHolder):
    """
    """

    def __init__(self, parent, obj_type='file', **kwargs):
        """Constructor.
        **kwargs:
            - 'path': 'relative\path\to\file.ext'
            - 'command': 'command string'
            - 'comment': 'comment at the end of the command'
        Args:
            hash(str): unique code for this object.
            parent(str): unique hash code for this object.
        Raises:
            keyError: if kwargs 'root', 'command', 'path' are not given.
        """
        root = kwargs['root']  # raises keyerror
        self.command = kwargs['command']
        path = kwargs['path']
        self.comment = kwargs.get('comment', '')
        TuflowPart.__init__(self, parent, obj_type, **kwargs)
        PathHolder.__init__(self, path, root)
        self.TOP_CLASS = 'file'
        self.all_types = None
        self.has_own_root = False