diff --git a/Utilities/JsonUtils/checkLint.py b/Utilities/JsonUtils/checkLint.py index fdd1fef0..dc37fe1e 100644 --- a/Utilities/JsonUtils/checkLint.py +++ b/Utilities/JsonUtils/checkLint.py @@ -1,10 +1,11 @@ import json +import sys def check(filename): try: - with open(filename) as f: - lf = json.load(f) + with open(filename) as fid: + json.load(fid) return True except: return False diff --git a/Utilities/JsonUtils/resolveFileInputJson.py b/Utilities/JsonUtils/resolveFileInputJson.py index b9da4c6e..50468abf 100644 --- a/Utilities/JsonUtils/resolveFileInputJson.py +++ b/Utilities/JsonUtils/resolveFileInputJson.py @@ -3,7 +3,7 @@ def resolveFileInputJson(battmoDir, jsoninput): - if type(jsoninput) is dict: + if isinstance(jsoninput, dict): if "isFile" in jsoninput: filename = jsoninput["filename"] fullfilename = os.path.join(battmoDir, filename) diff --git a/Utilities/JsonUtils/validateJsonFiles.m b/Utilities/JsonUtils/validateJsonFiles.m index 461c29de..8728789b 100644 --- a/Utilities/JsonUtils/validateJsonFiles.m +++ b/Utilities/JsonUtils/validateJsonFiles.m @@ -1,4 +1,4 @@ -function is_valid = validateJsonFiles(jsonfiles) +function isValid = validateJsonFiles(jsonfiles) if ~iscell(jsonfiles) jsonfiles = {jsonfiles}; @@ -14,17 +14,16 @@ jsonfile = jsonfiles{k}; dispif(mrstVerbose, 'Validating %s\n', jsonfile); try - %is_valid{k} = py.(modname).validate(battmoDir(), jsonfile); %#ok - py.(modname).validate(battmoDir(), jsonfile); %#ok + isValid{k} = py.(modname).validate(battmoDir(), jsonfile); %#ok catch e disp(e); error('Error when running the validation'); end - assert(is_valid{k}, 'jsonfile %s is not valid', jsonfile); + assert(isValid{k}, 'jsonfile %s is not valid', jsonfile); end if numel(jsonfiles) == 1 - is_valid = is_valid{1}; + isValid = isValid{1}; end end