33# SPDX-License-Identifier: Apache-2.0
44
55# SPDX-FileContributor: Michael Meinel
6+ # SPDX-FileContributor: Michael Fritzsche
67# SPDX-FileContributor: Stephan Druskat
78
89import logging
910
10- from ruamel import yaml
11+ from ruamel . yaml import YAML
1112import toml
1213
13- from hermes .commands .base import HermesCommand
1414from hermes .error import MisconfigurationError
1515from hermes .model .context_manager import HermesContext
16-
16+ from .. base import HermesCommand
1717from .base import HermesPostprocessPlugin
1818
1919
@@ -36,7 +36,7 @@ def __call__(self, command: HermesCommand):
3636 _log .error ("hermes.toml already contains a record_id for Invenio deposit." )
3737 raise MisconfigurationError (
3838 "Can't overwrite record_id automatically."
39- f"(Tried to overwrite { old_record_id } with { deposition [" record_id" ]} )"
39+ f"(Tried to overwrite { old_record_id } with { deposition [' record_id' ]} )"
4040 )
4141 except KeyError :
4242 pass
@@ -52,14 +52,14 @@ def __call__(self, command: HermesCommand):
5252 deposition = manager ["result" ]
5353 ctx .finalize_step ("deposit" )
5454
55- yaml_io = yaml . YAML ()
56- yaml_io .default_flow_style = False
57- yaml_io .allow_unicode = True
58- yaml_io .indent (mapping = 4 , sequence = 2 , offset = 0 )
59- yaml_io .allow_unicode = True
55+ yaml = YAML ()
56+ yaml .default_flow_style = False
57+ yaml .allow_unicode = True
58+ yaml .indent (mapping = 4 , sequence = 2 , offset = 0 )
59+ yaml .allow_unicode = True
6060
6161 try :
62- cff = yaml_io .load (open ('CITATION.cff' , 'r' ))
62+ cff = yaml .load (open ('CITATION.cff' , 'r' ))
6363 new_identifier = {
6464 'description' : f"DOI for the published version { deposition ['metadata' ]['version' ]} "
6565 "[generated by hermes]" ,
@@ -70,6 +70,6 @@ def __call__(self, command: HermesCommand):
7070 cff ['identifiers' ].append (new_identifier )
7171 else :
7272 cff ['identifiers' ] = [new_identifier ]
73- yaml_io .dump (cff , open ('CITATION.cff' , 'w' ))
73+ yaml .dump (cff , open ('CITATION.cff' , 'w' ))
7474 except Exception as e :
7575 raise RuntimeError ("Update of CITATION.cff failed." ) from e
0 commit comments