2bcab5d098
- moved all server related things into the folder `server`, so this configuration is parallel to the client. - All main "services" are now folders in the root directory - Added Dockerfiles to each service (currently server and client) - Added a docker compose configuration to start everything together. Currently there are heavy dependencies into https://github.com/OpenSlides/openslides-docker-compose - Resturctured the .gitignore. If someone needs something excluded, please add it to the right section. - Added initial build setup with Docker and docker-compose. - removed setup.py. We won't deliver OpenSlides via pip anymore.
26 lines
720 B
Python
26 lines
720 B
Python
from argparse import Namespace
|
|
from typing import Any, Optional
|
|
|
|
|
|
class OpenSlidesArguments:
|
|
args: Optional[Namespace] = None
|
|
|
|
def __getitem__(self, key: str) -> Any:
|
|
if not self.args:
|
|
raise KeyError("Arguments are not set.")
|
|
if not hasattr(self.args, key):
|
|
raise KeyError(f"Key '{key}' is not in the OpenSlides arguments.")
|
|
return getattr(self.args, key)
|
|
|
|
def get(self, key: str, default: Any) -> Any:
|
|
if not self.args or not hasattr(self.args, key):
|
|
return default
|
|
else:
|
|
return getattr(self.args, key)
|
|
|
|
def set_arguments(self, args: Namespace) -> None:
|
|
self.args = args
|
|
|
|
|
|
arguments = OpenSlidesArguments()
|