Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rhinoella committed Jun 12, 2024
1 parent 5c0f43a commit 339bf9f
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions gudpy/core/gudpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,7 @@ def runGudrun(self, gudrunFile: GudrunFile = None):
gudrunFile = self.gudrunFile
self.save()
self.gudrun = Gudrun()
exitcode = self.gudrun.gudrun(
gudrunFile=gudrunFile,
purge=self.purge
)
exitcode = self.gudrun.gudrun(gudrunFile=gudrunFile)
if exitcode:
raise exc.GudrunException(
"Gudrun failed to run with the following output:\n"
Expand Down Expand Up @@ -468,7 +465,7 @@ def gudrun(
iterator: iterators.Iterator = None,
) -> int:
self.checkBinary()
if not purge and not suppress:
if not purge:
cli.echoWarning("Gudrun running without purge")
with tempfile.TemporaryDirectory() as tmp:
purgeFiles = []
Expand Down Expand Up @@ -501,10 +498,10 @@ def gudrun(
self.exitcode = 1
return self.exitcode

if iterator and save:
if iterator:
self.gudrunOutput = iterator.organiseOutput(
gudrunFile, exclude=purgeFiles)
elif save:
else:
self.gudrunOutput = self.organiseOutput(
gudrunFile, exclude=purgeFiles)
gudrunFile.setGudrunDir(self.gudrunOutput.path)
Expand Down Expand Up @@ -544,19 +541,19 @@ def singleIteration(
prevOutput: handlers.GudrunOutput,
) -> typ.Tuple[int, str]: # (exitcode, error)
modGfFile = self.iterator.performIteration(gudrunFile, prevOutput)
exitcode = gudrun.gudrun(modGfFile, purge, self.iterator, save=save)
exitcode = gudrun.gudrun(modGfFile, purge, self.iterator)
if exitcode:
return exitcode
self.gudrunOutput = gudrun.gudrunOutput
return 0

def iterate(self, purge, save=True) -> typ.Tuple[int, str]:
def iterate(self, purge) -> typ.Tuple[int, str]:
prevOutput = None

# If the iterator requires a prelimenary run
if self.iterator.requireDefault:
exitcode = self.gudrunObjects[0].gudrun(
self.gudrunFile, purge, self.iterator, save)
self.gudrunFile, purge, self.iterator)
if exitcode: # An exit code != 0 indicates failure
self.exitcode = (exitcode, self.gudrunObjects[0].error)
return self.exitcode
Expand All @@ -568,7 +565,7 @@ def iterate(self, purge, save=True) -> typ.Tuple[int, str]:
# If object has already been run, skip
continue
exitcode = self.singleIteration(
self.gudrunFile, gudrun, purge, prevOutput, save)
self.gudrunFile, gudrun, purge, prevOutput)
if exitcode: # An exit code != 0 indicates failure
self.exitcode = (exitcode, gudrun.error)
return self.exitcode
Expand Down Expand Up @@ -604,19 +601,19 @@ def singleIteration(
prevOutput: handlers.GudrunOutput,
) -> typ.Tuple[int, str]: # (exitcode, error)
modGfFile = self.iterator.performIteration(gudrunFile, prevOutput)
exitcode = gudrun.gudrun(modGfFile, purge, self.iterator, save=save)
exitcode = gudrun.gudrun(modGfFile, purge, self.iterator)
if exitcode:
return exitcode
self.gudrunOutput = gudrun.gudrunOutput
return 0

def iterate(self, purge, save=True) -> typ.Tuple[int, str]:
def iterate(self, purge) -> typ.Tuple[int, str]:
prevOutput = None

# If the iterator requires a prelimenary run
if self.iterator.requireDefault:
exitcode = self.gudrunObjects[0].gudrun(
self.gudrunFile, purge, self.iterator, save)
self.gudrunFile, purge, self.iterator)
if exitcode: # An exit code != 0 indicates failure
self.exitcode = (exitcode, self.gudrunObjects[0].error)
return self.exitcode
Expand All @@ -628,7 +625,7 @@ def iterate(self, purge, save=True) -> typ.Tuple[int, str]:
# If object has already been run, skip
continue
exitcode = self.singleIteration(
self.gudrunFile, gudrun, purge, prevOutput, save)
self.gudrunFile, gudrun, purge, prevOutput)
if exitcode: # An exit code != 0 indicates failure
self.exitcode = (exitcode, gudrun.error)
return self.exitcode
Expand Down

0 comments on commit 339bf9f

Please sign in to comment.