|
6 | 6 | from datetime import datetime |
7 | 7 | from pathlib import Path |
8 | 8 | from typing import Any |
9 | | -import json |
10 | | -from collections import UserDict |
11 | | - |
12 | | -import pytz |
13 | 9 |
|
14 | 10 | import pyttman |
15 | 11 | from pyttman.core.containers import MessageMixin, Reply |
@@ -68,31 +64,15 @@ def __init__(self, dictionary=None, **kwargs): |
68 | 64 | self.LOG_FORMAT: str | None = None |
69 | 65 | self.LOG_TO_STDOUT: bool = False |
70 | 66 | self.STATIC_FILES_DIR: Path | None = None |
71 | | - self.TIME_ZONE: pytz.timezone = None |
72 | 67 |
|
73 | | - [self._set_attr(k, v) for k, v in kwargs.items() |
| 68 | + [setattr(self, k, v) for k, v in kwargs.items() |
74 | 69 | if not inspect.ismodule(v) |
75 | 70 | and not inspect.isfunction(v)] |
76 | 71 |
|
77 | | - def __getitem__(self, item): |
78 | | - return self.__dict__[item] |
79 | | - |
80 | | - def _set_attr(self, k, v): |
81 | | - tmp = v |
82 | | - if isinstance(v, dict): |
83 | | - tmp = Settings._dict_to_object(v) |
84 | | - |
85 | | - setattr(self, k, tmp) |
86 | | - |
87 | 72 | def __repr__(self): |
88 | 73 | _attrs = {name: value for name, value in self.__dict__.items()} |
89 | 74 | return f"Settings({_attrs})" |
90 | 75 |
|
91 | | - @staticmethod |
92 | | - def _dict_to_object(dictionary): |
93 | | - return json.loads(json.dumps(dictionary), object_hook=Settings) |
94 | | - |
95 | | - |
96 | 76 | def _generate_name(name): |
97 | 77 | """ |
98 | 78 | Generates a user-friendly name out of |
|
0 commit comments