Module secfsdstools.a_config.configmodel
Base Model for configuration.
Expand source code
"""
Base Model for configuration.
"""
import configparser
import os
from dataclasses import asdict, dataclass
from typing import Optional
@dataclass
class Configuration:
"""Basic configuration settings"""
download_dir: str
db_dir: str
parquet_dir: str
user_agent_email: str
auto_update: bool = True
keep_zip_files: bool = False
no_parallel_processing: bool = False
config_parser: Optional[configparser.ConfigParser] = None
post_update_hook: Optional[str] = None
post_update_processes: Optional[str] = None
daily_download_dir: str = ""
daily_processing: bool = False
def __post_init__(self):
if self.daily_download_dir == "":
self.daily_download_dir = os.path.join(os.path.dirname(self.download_dir), "dld_daily")
def get_dict(self):
"""
returns the configuration as a dictionary
Returns:
the configuration as a dictionary
"""
return dict(asdict(self))
Classes
class Configuration (download_dir: str, db_dir: str, parquet_dir: str, user_agent_email: str, auto_update: bool = True, keep_zip_files: bool = False, no_parallel_processing: bool = False, config_parser: Optional[configparser.ConfigParser] = None, post_update_hook: Optional[str] = None, post_update_processes: Optional[str] = None, daily_download_dir: str = '', daily_processing: bool = False)
-
Basic configuration settings
Expand source code
@dataclass class Configuration: """Basic configuration settings""" download_dir: str db_dir: str parquet_dir: str user_agent_email: str auto_update: bool = True keep_zip_files: bool = False no_parallel_processing: bool = False config_parser: Optional[configparser.ConfigParser] = None post_update_hook: Optional[str] = None post_update_processes: Optional[str] = None daily_download_dir: str = "" daily_processing: bool = False def __post_init__(self): if self.daily_download_dir == "": self.daily_download_dir = os.path.join(os.path.dirname(self.download_dir), "dld_daily") def get_dict(self): """ returns the configuration as a dictionary Returns: the configuration as a dictionary """ return dict(asdict(self))
Class variables
var auto_update : bool
var config_parser : Optional[configparser.ConfigParser]
var daily_download_dir : str
var daily_processing : bool
var db_dir : str
var download_dir : str
var keep_zip_files : bool
var no_parallel_processing : bool
var parquet_dir : str
var post_update_hook : Optional[str]
var post_update_processes : Optional[str]
var user_agent_email : str
Methods
def get_dict(self)
-
returns the configuration as a dictionary
Returns
the configuration as a dictionary
Expand source code
def get_dict(self): """ returns the configuration as a dictionary Returns: the configuration as a dictionary """ return dict(asdict(self))