Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit ecd458f

Browse files
committed
source: df: Ensure default_factory is used for mutable defaults (Python 3.12 support)
Signed-off-by: John Andersen <johnandersenpdx@gmail.com>
1 parent 715e6c2 commit ecd458f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

dffml/source/df.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class DataFlowSourceConfig:
1919
features: Features = field(
2020
"Features to pass as definitions to each context from each "
2121
"record to be preprocessed",
22-
default=Features(),
22+
default_factory=lambda: Features(),
2323
)
2424
inputs: List[str] = field(
2525
"Other inputs to add under each ctx (record's key will "
@@ -42,7 +42,8 @@ class DataFlowSourceConfig:
4242
"Do not exit on operation exceptions, just log errors", default=False,
4343
)
4444
orchestrator: BaseOrchestrator = field(
45-
"Orchestrator", default=MemoryOrchestrator.withconfig({}),
45+
"Orchestrator",
46+
default_factory=lambda: MemoryOrchestrator.withconfig({}),
4647
)
4748

4849

dffml/source/dfpreprocess.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class DataFlowPreprocessSourceConfig:
2121
features: Features = field(
2222
"Features to pass as definitions to each context from each "
2323
"record to be preprocessed",
24-
default=Features(),
24+
default_factory=lambda: Features(),
2525
)
2626
inputs: List[str] = field(
2727
"Other inputs to add under each ctx (record's key will "
@@ -47,7 +47,8 @@ class DataFlowPreprocessSourceConfig:
4747
"Do not exit on operation exceptions, just log errors", default=False,
4848
)
4949
orchestrator: BaseOrchestrator = field(
50-
"Orchestrator", default=MemoryOrchestrator.withconfig({}),
50+
"Orchestrator",
51+
default_factory=lambda: MemoryOrchestrator.withconfig({}),
5152
)
5253

5354

0 commit comments

Comments
 (0)