Skip to content

Commit

Permalink
Fix pycodestyle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-basevi committed Aug 15, 2024
1 parent 3b6633a commit 7ff9f46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
14 changes: 6 additions & 8 deletions payu/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def calculate_fast(self, previous_manifest):
hashfn=self.fast_hashes,
force=True,
fullpaths=[self.fullpath(fpath) for fpath
in list(self.data.keys())]
in list(self.data.keys())]
)

# If fast hashes from previous manifest match, use previous full hashes
Expand All @@ -70,7 +70,7 @@ def calculate_fast(self, previous_manifest):
changed_filepaths = set()
for filepath in self.data.keys():
for hash in self.data[filepath]['hashes'].values():
if hash == None:
if hash is None:
changed_filepaths.add(filepath)

# Calculate full hashes for these changed filepaths
Expand All @@ -80,7 +80,7 @@ def calculate_fast(self, previous_manifest):
hashfn=self.full_hashes,
force=True,
fullpaths=[self.fullpath(fpath) for fpath
in list(changed_filepaths)]
in list(changed_filepaths)]
)

def check_reproduce(self, previous_manifest):
Expand All @@ -101,7 +101,7 @@ def check_reproduce(self, previous_manifest):
differences.append(
f"{filepath}: {hashfn}: {previous_hash} != {hash}"
)

if len(differences) != 0:
sys.stderr.write(
f'Run cannot reproduce: manifest {self.path} is not correct\n'
Expand All @@ -123,13 +123,11 @@ def add_filepath(self, filepath, fullpath, hashes, copy=False):

# Ignore directories
if os.path.isdir(fullpath):
# TODO: Add debug logging
return False

# Ignore anything matching the ignore patterns
for pattern in self.ignore:
if fnmatch.fnmatch(os.path.basename(fullpath), pattern):
#TODO: Add debug logging
return False

if filepath not in self.data:
Expand Down Expand Up @@ -280,7 +278,7 @@ def __iter__(self):
def __len__(self):
"""Return the number of manifests in the manifest class."""
return len(self.manifests)

def load_manifests(self):
"""
Load pre-existing manifests
Expand Down Expand Up @@ -315,7 +313,7 @@ def check_manifests(self):
if self.reproduce[mf]:
# Compare manifest with previous manifest
self.manifests[mf].check_reproduce(self.previous_manifests[mf])

# Update manifests if there's any changes, or create file if empty
for mf in self.manifests:
if (self.manifests[mf].data != self.previous_manifests[mf].data
Expand Down
2 changes: 1 addition & 1 deletion payu/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def setup(self):
workrelpath = os.path.relpath(path, input_path)
subdir = os.path.normpath(
os.path.join(self.work_input_path_local,
workrelpath)
workrelpath)
)

if not os.path.exists(subdir):
Expand Down
10 changes: 5 additions & 5 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
'exe': 'test.exe',
'input': 'testrun_1',
'manifest': {
'reproduce': {
'input': False,
'exe': False
}
},
'reproduce': {
'input': False,
'exe': False
}
},
'runlog': False,
"experiment": ctrldir_basename,
"metadata": {
Expand Down

0 comments on commit 7ff9f46

Please sign in to comment.