Skip to content

Commit 456eebd

Browse files
committed
style: some refactoring in holdings_marc_transformer
1 parent a79e9c3 commit 456eebd

2 files changed

Lines changed: 26 additions & 12 deletions

File tree

src/folio_migration_tools/migration_tasks/holdings_marc_transformer.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'''Main "script."'''
2-
31
import csv
42
import json
53
import logging
@@ -19,7 +17,10 @@
1917
from folio_migration_tools.marc_rules_transformation.rules_mapper_holdings import (
2018
RulesMapperHoldings,
2119
)
22-
from folio_migration_tools.migration_tasks.migration_task_base import MarcTaskConfigurationBase, MigrationTaskBase
20+
from folio_migration_tools.migration_tasks.migration_task_base import (
21+
MarcTaskConfigurationBase,
22+
MigrationTaskBase
23+
)
2324

2425

2526
class HoldingsMarcTransformer(MigrationTaskBase):
@@ -37,14 +38,18 @@ class TaskConfiguration(MarcTaskConfigurationBase):
3738
str,
3839
Field(
3940
title="Migration task type",
40-
description=("The type of migration task you want to perform"),
41+
description=(
42+
"The type of migration task you want to perform"
43+
),
4144
),
4245
]
4346
files: Annotated[
4447
List[FileDefinition],
4548
Field(
4649
title="Source files",
47-
description=("List of MARC21 files with holdings records"),
50+
description=(
51+
"List of MARC21 files with holdings records"
52+
),
4853
),
4954
]
5055
hrid_handling: Annotated[
@@ -125,8 +130,8 @@ class TaskConfiguration(MarcTaskConfigurationBase):
125130
default_call_number_type_name: Annotated[
126131
str,
127132
Field(
128-
title="Default callnumber type name",
129-
description="The name of the callnumber type that will be used as fallback",
133+
title="Default call_number type name",
134+
description="The name of the call_number type that will be used as fallback",
130135
),
131136
]
132137
fallback_holdings_type_id: Annotated[
@@ -140,16 +145,21 @@ class TaskConfiguration(MarcTaskConfigurationBase):
140145
str,
141146
Field(
142147
title="Supplemental MFHD mapping rules file",
143-
description="The name of the file in the mapping_files directory containing supplemental MFHD mapping rules",
148+
description=(
149+
"The name of the file in the mapping_files directory "
150+
"containing supplemental MFHD mapping rules"
151+
),
144152
),
145153
] = ""
146154
include_mrk_statements: Annotated[
147155
bool,
148156
Field(
149157
title="Include MARC statements (MRK-format) as staff-only Holdings notes",
150158
description=(
151-
"If set to true, the MARC statements will be included in the output as MARC Maker format fields. "
152-
"If set to false (default), the MARC statements will not be included in the output."
159+
"If set to true, the MARC statements "
160+
"will be included in the output as MARC Maker format fields. "
161+
"If set to false (default), the MARC statements "
162+
"will not be included in the output."
153163
),
154164
),
155165
] = False
@@ -188,7 +198,8 @@ class TaskConfiguration(MarcTaskConfigurationBase):
188198
title="Include MARC Record (as MARC21 decoded string) as note",
189199
description=(
190200
"If set to true, the MARC record will be included in the output as a "
191-
"decoded binary MARC21 record. If set to false (default), the MARC record will not be "
201+
"decoded binary MARC21 record. If set to false (default), "
202+
"the MARC record will not be "
192203
"included in the output."
193204
),
194205
),
@@ -215,6 +226,7 @@ def __init__(
215226
use_logging: bool = True,
216227
):
217228
csv.register_dialect("tsv", delimiter="\t")
229+
self.task_configuration = task_config
218230
super().__init__(library_config, task_config, folio_client, use_logging)
219231
if self.task_configuration.statistical_codes_map_file_name:
220232
statcode_mapping = self.load_ref_data_mapping_file(

src/folio_migration_tools/task_configuration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ class AbstractTaskConfiguration(BaseModel):
2525
str,
2626
Field(
2727
title="Migration task type",
28-
description=("The type of migration task you want to perform."),
28+
description=(
29+
"The type of migration task you want to perform."
30+
),
2931
),
3032
]
3133
ecs_tenant_id: Annotated[

0 commit comments

Comments
 (0)