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

Commit

Permalink
source: df: Ensure default_factory is used for mutable defaults (Pyth…
Browse files Browse the repository at this point in the history
…on 3.12 support)

Signed-off-by: John Andersen <[email protected]>
  • Loading branch information
pdxjohnny committed Nov 22, 2023
1 parent 715e6c2 commit ecd458f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dffml/source/df.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class DataFlowSourceConfig:
features: Features = field(
"Features to pass as definitions to each context from each "
"record to be preprocessed",
default=Features(),
default_factory=lambda: Features(),
)
inputs: List[str] = field(
"Other inputs to add under each ctx (record's key will "
Expand All @@ -42,7 +42,8 @@ class DataFlowSourceConfig:
"Do not exit on operation exceptions, just log errors", default=False,
)
orchestrator: BaseOrchestrator = field(
"Orchestrator", default=MemoryOrchestrator.withconfig({}),
"Orchestrator",
default_factory=lambda: MemoryOrchestrator.withconfig({}),
)


Expand Down
5 changes: 3 additions & 2 deletions dffml/source/dfpreprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DataFlowPreprocessSourceConfig:
features: Features = field(
"Features to pass as definitions to each context from each "
"record to be preprocessed",
default=Features(),
default_factory=lambda: Features(),
)
inputs: List[str] = field(
"Other inputs to add under each ctx (record's key will "
Expand All @@ -47,7 +47,8 @@ class DataFlowPreprocessSourceConfig:
"Do not exit on operation exceptions, just log errors", default=False,
)
orchestrator: BaseOrchestrator = field(
"Orchestrator", default=MemoryOrchestrator.withconfig({}),
"Orchestrator",
default_factory=lambda: MemoryOrchestrator.withconfig({}),
)


Expand Down

0 comments on commit ecd458f

Please sign in to comment.