diff options
| author | rr- | 2017-02-04 01:08:12 +0100 |
|---|---|---|
| committer | rr- | 2017-02-05 16:34:45 +0100 |
| commit | ad842ee8a54c57463b8e28b52970f173ea1d64ea (patch) | |
| tree | 1238e8270878801a2ddb10bc4db469115c026cab /server/szurubooru/config.py | |
| parent | abf1fc2b2d135299fe7e8a700d4e7a18966d7bfe (diff) | |
server: refactor + add type hinting
- Added type hinting (for now, 3.5-compatible)
- Split `db` namespace into `db` module and `model` namespace
- Changed elastic search to be created lazily for each operation
- Changed to class based approach in entity serialization to allow
stronger typing
- Removed `required` argument from `context.get_*` family of functions;
now it's implied if `default` argument is omitted
- Changed `unalias_dict` implementation to use less magic inputs
Diffstat (limited to 'server/szurubooru/config.py')
| -rw-r--r-- | server/szurubooru/config.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/szurubooru/config.py b/server/szurubooru/config.py index e569311..567b457 100644 --- a/server/szurubooru/config.py +++ b/server/szurubooru/config.py @@ -1,8 +1,9 @@ +from typing import Dict import os import yaml -def merge(left, right): +def merge(left: Dict, right: Dict) -> Dict: for key in right: if key in left: if isinstance(left[key], dict) and isinstance(right[key], dict): @@ -14,7 +15,7 @@ def merge(left, right): return left -def read_config(): +def read_config() -> Dict: with open('../config.yaml.dist') as handle: ret = yaml.load(handle.read()) if os.path.exists('../config.yaml'): |