check_path() added
This commit is contained in:
parent
f70be87f43
commit
2087ca6922
@ -134,6 +134,25 @@ class Entry(object):
|
|||||||
if not os.path.isfile(getattr(self, name)):
|
if not os.path.isfile(getattr(self, name)):
|
||||||
return "File '" + getattr(self, name) + "' does not exist."
|
return "File '" + getattr(self, name) + "' does not exist."
|
||||||
|
|
||||||
|
def check_path(self, name) -> Union[None, str]:
|
||||||
|
"""
|
||||||
|
Check a parameter to be a valid path to a file.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
name : str
|
||||||
|
The name of the parameter to be checked.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
mes : Union[None, str]
|
||||||
|
The error message of the check. This will be None if the check was successful.
|
||||||
|
"""
|
||||||
|
if not hasattr(self, name):
|
||||||
|
return "Parameter '" + name + "' not found."
|
||||||
|
if not os.path.isdir(getattr(self, name)):
|
||||||
|
return "Path '" + getattr(self, name) + "' does not exist."
|
||||||
|
|
||||||
def check_float(self, name) -> Union[None, str]:
|
def check_float(self, name) -> Union[None, str]:
|
||||||
"""
|
"""
|
||||||
Check a parameter to be a floating point value
|
Check a parameter to be a floating point value
|
||||||
|
Loading…
Reference in New Issue
Block a user