Create config file and VS code workspace.

This commit is contained in:
2021-10-25 17:52:13 -04:00
parent bf491f5e19
commit ac37021424
4 changed files with 93 additions and 63 deletions

24
config.py Normal file
View File

@@ -0,0 +1,24 @@
import json
from typing import List
from pydantic import BaseModel
class BlockList(BaseModel):
name: str = ''
prefix: str = ''
postfix: str = ''
items: List[str]
class Config(BaseModel):
class Config:
extra = 'forbid'
blocklists: List[BlockList]
def load_config(config_file: str) -> Config:
with open(config_file, 'r', encoding='utf8') as f:
config_dict = json.load(f)
return Config(**config_dict)