Skip to content

Commit

Permalink
Convert WalkConfig to dataclass
Browse files Browse the repository at this point in the history
Otherwise creating multiple instances of WalkConfig used static class
properties.
  • Loading branch information
glensc committed Jul 9, 2024
1 parent 2431e17 commit 7c077f2
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions plextraktsync/plan/WalkConfig.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
from __future__ import annotations

from dataclasses import dataclass, field


@dataclass
class WalkConfig:
walk_movies = True
walk_shows = True
walk_watchlist = True
library: list[str] = []
show: list[str] = []
movie: list[str] = []
id: list[str] = []

def __init__(self, movies=True, shows=True, watchlist=True):
self.walk_movies = movies
self.walk_shows = shows
self.walk_watchlist = watchlist
library: list[str] = field(default_factory=list)
show: list[str] = field(default_factory=list)
movie: list[str] = field(default_factory=list)
id: list[str] = field(default_factory=list)

def update(self, movies=None, shows=None, watchlist=None):
if movies is not None:
Expand Down

0 comments on commit 7c077f2

Please sign in to comment.