Skip to content

Commit

Permalink
fix(clipper): fix ValueError exception with python>=3.11 from Clipper…
Browse files Browse the repository at this point in the history
…State dataclass decorator

* use default factory functions for mutable ClipperState dataclass fields
* dataclass() decorator will raise a ValueError if it detects an unhashable default parameter (assumes unhashable => mutable)
* Using default factory functions is a way to create new instances of mutable types as default values for fields:
  • Loading branch information
exwm committed Aug 12, 2023
1 parent 94fa118 commit dc9c937
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/clipper/clipper_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class ClipperState:
"""Central state for yt_clipper functions."""

settings: Settings = field(default_factory=dict)
clipper_paths: ClipperPaths = ClipperPaths()
reportStream = io.StringIO()
reportStreamColored = io.StringIO()
clipper_paths: ClipperPaths = field(default_factory=ClipperPaths)
reportStream: io.StringIO = field(default_factory=io.StringIO)
reportStreamColored: io.StringIO = field(default_factory=io.StringIO)


class MissingMergeInput(Exception):
Expand Down

0 comments on commit dc9c937

Please sign in to comment.