forked from openwallet-foundation/acapy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_context.py
30 lines (21 loc) · 882 Bytes
/
base_context.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Base injection context builder classes."""
from abc import ABC, abstractmethod
from typing import Any, Mapping, Optional
from .injection_context import InjectionContext
from .settings import Settings
class ContextBuilder(ABC):
"""Base injection context builder class."""
def __init__(self, settings: Optional[Mapping[str, Any]] = None):
"""
Initialize an instance of the context builder.
Args:
settings: Mapping of configuration settings
"""
self.settings = Settings(settings)
@abstractmethod
async def build_context(self) -> InjectionContext:
"""Build the base injection context."""
def update_settings(self, settings: Mapping[str, object]):
"""Update the context builder with additional settings."""
if settings:
self.settings = self.settings.extend(settings)