Skip to content

Commit 8e1c1d6

Browse files
bltravisbtravisebsco
authored andcommitted
Make type checker happier
1 parent 936a34f commit 8e1c1d6

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/folio_migration_tools/marc_rules_transformation/conditions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ def condition_set_identifier_type_id_by_value(
386386
"MappedIdentifierTypes", f"{marc_field.tag} -> {t[1]}"
387387
)
388388
return t[0]
389-
identifier_type: dict = next(
389+
identifier_type: dict | None = next(
390390
(
391391
f
392392
for f in self.folio.identifier_types # type: ignore
@@ -397,6 +397,12 @@ def condition_set_identifier_type_id_by_value(
397397
),
398398
None,
399399
)
400+
if identifier_type is None:
401+
raise TransformationFieldMappingError(
402+
legacy_id,
403+
i18n.t("no matching identifier_types in %{names}", names=parameter["names"]),
404+
marc_field,
405+
)
400406
self.mapper.migration_report.add("MappedIdentifierTypes", identifier_type["name"])
401407
my_id = identifier_type["id"]
402408
if not my_id:

src/folio_migration_tools/marc_rules_transformation/rules_mapper_bibs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def handle_holdings(self, marc_record: Record):
287287
def wrap_up(self):
288288
logger.info("Mapper wrapping up")
289289
if self.create_source_records:
290-
if self.task_configuration.update_hrid_settings:
290+
if getattr(self.task_configuration, "update_hrid_settings", False):
291291
self.hrid_handler.store_hrid_settings()
292292

293293
def get_instance_type_id(self, marc_record: Record, legacy_ids: List[str]) -> str:

0 commit comments

Comments
 (0)