Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions trakt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__author__ = 'Elan Ruusamäe'

import json
from dataclasses import dataclass
from dataclasses import dataclass, fields
from os.path import exists
from typing import Optional

Expand Down Expand Up @@ -40,7 +40,8 @@ def update(self, **kwargs):

def all(self):
result = {}
for key in self.__annotations__.keys():
for field in fields(self):
key = field.name
result[key] = self.get(key)

return result
Expand All @@ -55,7 +56,8 @@ def load(self):
with open(self.config_path) as config_file:
config_data = json.load(config_file)

for key in self.__annotations__.keys():
for field in fields(self):
key = field.name
# Don't overwrite
if self.get(key) is not None:
continue
Expand Down