Skip to content

Commit a30d385

Browse files
author
notactuallyfinn
committed
changed imports and fixed syntax error for python 3.10
1 parent bd7e732 commit a30d385

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

src/hermes/commands/postprocess/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
# SPDX-FileContributor: Michael Meinel
6+
# SPDX-FileContributor: Michael Fritzsche
67

78
import argparse
89

910
from pydantic import BaseModel
1011

11-
from hermes.commands.base import HermesCommand, HermesPlugin
12+
from ..base import HermesCommand, HermesPlugin
1213

1314

1415
class HermesPostprocessPlugin(HermesPlugin):

src/hermes/commands/postprocess/invenio.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
# SPDX-FileContributor: Michael Meinel
6+
# SPDX-FileContributor: Michael Fritzsche
67
# SPDX-FileContributor: Stephan Druskat
78

89
import logging
910

10-
from ruamel import yaml
11+
from ruamel.yaml import YAML
1112
import toml
1213

13-
from hermes.commands.base import HermesCommand
1414
from hermes.error import MisconfigurationError
1515
from hermes.model.context_manager import HermesContext
16-
16+
from ..base import HermesCommand
1717
from .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

src/hermes/commands/postprocess/invenio_rdm.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
# SPDX-FileContributor: Michael Meinel
6+
# SPDX-FileContributor: Michael Fritzsche
67
# SPDX-FileContributor: Stephan Druskat
78

89
import logging
910

1011
import toml
1112

12-
from hermes.commands.base import HermesCommand
1313
from hermes.error import MisconfigurationError
1414
from hermes.model.context_manager import HermesContext
15-
15+
from ..base import HermesCommand
1616
from .base import HermesPostprocessPlugin
1717

18+
1819
_log = logging.getLogger('postprocess.invenio_rdm')
1920

2021

@@ -34,7 +35,7 @@ def __call__(self, command: HermesCommand):
3435
_log.error("hermes.toml already contains a record_id for Invenio_RDM deposit.")
3536
raise MisconfigurationError(
3637
"Can't overwrite record_id automatically."
37-
f"(Tried to overwrite {old_record_id} with {deposition["record_id"]})"
38+
f"(Tried to overwrite {old_record_id} with {deposition['record_id']})"
3839
)
3940
except KeyError:
4041
pass

0 commit comments

Comments
 (0)