Commit 3013ebde authored by Frédéric Escudié's avatar Frédéric Escudié
Browse files

Add AbstractInputFile.

parent 0f71688d
...@@ -403,9 +403,20 @@ class Parameter(str, AbstractParameter): ...@@ -403,9 +403,20 @@ class Parameter(str, AbstractParameter):
flag=None, sub_parameters=None, group="default", display_name=None): flag=None, sub_parameters=None, group="default", display_name=None):
AbstractParameter.__init__(self, name, help, flag=flag, default=default, type=type, choices=choices, required=required, AbstractParameter.__init__(self, name, help, flag=flag, default=default, type=type, choices=choices, required=required,
action="store", sub_parameters=sub_parameters, group=group, display_name=display_name) action="store", sub_parameters=sub_parameters, group=group, display_name=display_name)
class InputFile(Parameter, AbstractIOFile): class AbstractInputFile(AbstractIOFile):
"""
@summary : Parent of all InputFile(s) parameters.
"""
pass
class AbstractOutputFile(AbstractIOFile):
"""
@summary : Parent of all OutputFile(s) parameters.
"""
pass
class InputFile(Parameter, AbstractInputFile):
def __new__(self, name, help, file_format="any", default="", type="localfile", choices=None, def __new__(self, name, help, file_format="any", default="", type="localfile", choices=None,
required=False, flag=None, group="default", display_name=None): required=False, flag=None, group="default", display_name=None):
...@@ -426,12 +437,6 @@ class InputFile(Parameter, AbstractIOFile): ...@@ -426,12 +437,6 @@ class InputFile(Parameter, AbstractIOFile):
Parameter.__init__(self, name, help, flag=flag, default=default, type=type, choices=choices, Parameter.__init__(self, name, help, flag=flag, default=default, type=type, choices=choices,
required=required, group=group, display_name=display_name) required=required, group=group, display_name=display_name)
class AbstractOutputFile(AbstractIOFile):
"""
@summary : Parent of all OutputFile(s) parameters.
"""
pass
class OutputFile(Parameter, AbstractOutputFile): class OutputFile(Parameter, AbstractOutputFile):
def __new__(self, name, help, file_format="any", default="", choices=None, def __new__(self, name, help, file_format="any", default="", choices=None,
...@@ -458,7 +463,7 @@ class ParameterList(list, AbstractParameter): ...@@ -458,7 +463,7 @@ class ParameterList(list, AbstractParameter):
return list.__init__(self, default) return list.__init__(self, default)
class InputFileList(ParameterList, AbstractIOFile): class InputFileList(ParameterList, AbstractInputFile):
def __init__(self, name, help, file_format="any", default=None, type="localfile", choices=None, def __init__(self, name, help, file_format="any", default=None, type="localfile", choices=None,
required=False, flag=None, group="default", display_name=None): required=False, flag=None, group="default", display_name=None):
...@@ -478,11 +483,9 @@ class InputFileList(ParameterList, AbstractIOFile): ...@@ -478,11 +483,9 @@ class InputFileList(ParameterList, AbstractIOFile):
if default.__class__.__name__ == "str": if default.__class__.__name__ == "str":
return list.__init__(self, [default]) return list.__init__(self, [default])
elif default.__class__.__name__ == "InputFile":
return list.__init__(self, default)
elif default.__class__.__name__ == "list": elif default.__class__.__name__ == "list":
return list.__init__(self, default) return list.__init__(self, default)
elif default.__class__.__name__ == "InputFileList": elif issubclass( default.__class__, AbstractInputFile ):
return list.__init__(self, default) return list.__init__(self, default)
elif issubclass( default.__class__, AbstractOutputFile ): elif issubclass( default.__class__, AbstractOutputFile ):
return list.__init__(self, default) return list.__init__(self, default)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment