Skip to content

Commit

Permalink
Applied changes suggested in comment on issue #2
Browse files Browse the repository at this point in the history
  • Loading branch information
notactuallyfinn authored Jul 15, 2024
1 parent 9893077 commit 47a10c0
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/hermes_toml/harvest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,10 @@ class TomlHarvestPlugin(HermesHarvestPlugin):
def __call__(self, command: HermesHarvestCommand):
"""start of the process of harvesting the .toml file"""

#set the working directory to the correct location
path = command.args.path
old_path = pathlib.Path.cwd()
if path != old_path:
chdir(path)

#harvesting the data from the .toml file specified in the Settings class
data = self.read_from_toml(command.settings.toml.filename)

#resetting the working directory
if path != old_path:
chdir(old_path)
#set the working directory temporary to the correct location
with chdir(command.args.path):
#harvesting the data from the .toml file specified in the Settings class
data = self.read_from_toml(command.settings.toml.filename)

#returning the harvested data and some metadata
return data, {"filename": command.settings.toml.filename}
Expand Down

0 comments on commit 47a10c0

Please sign in to comment.