Skip to content

Commit

Permalink
Revert profile inject
Browse files Browse the repository at this point in the history
Signed-off-by: jamshale <[email protected]>
  • Loading branch information
jamshale committed Feb 15, 2024
1 parent a7c022a commit 16819d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
10 changes: 3 additions & 7 deletions aries_cloudagent/config/provider.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
"""Service provider implementations."""

import hashlib

from typing import Optional, Sequence, Union
from weakref import ReferenceType

from ..utils.classloader import DeferLoad
from ..utils.stats import Collector

from .base import BaseProvider, BaseSettings, BaseInjector, InjectionError
from .base import BaseInjector, BaseProvider, BaseSettings, InjectionError


class InstanceProvider(BaseProvider):
Expand Down Expand Up @@ -52,10 +50,8 @@ def __init__(
self._ctor_kwargs = ctor_kwargs
self._init_method = init_method
if isinstance(instance_cls, str):
cls = DeferLoad(instance_cls)
else:
cls = instance_cls
self._instance_cls: Union[type, DeferLoad] = cls
instance_cls = DeferLoad(instance_cls)
self._instance_cls = instance_cls

def provide(self, config: BaseSettings, injector: BaseInjector):
"""Provide the object instance given a config and injector."""
Expand Down
14 changes: 3 additions & 11 deletions aries_cloudagent/core/profile.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
"""Classes for managing profile information within a request context."""

import logging

from abc import ABC, abstractmethod
from typing import Any, Mapping, Optional, Type
from weakref import ref

from .event_bus import EventBus, Event
from ..config.base import InjectionError
from ..config.injector import BaseInjector, InjectType
from ..config.injection_context import InjectionContext
from ..config.injector import BaseInjector, InjectType
from ..config.provider import BaseProvider
from ..config.settings import BaseSettings
from ..utils.classloader import ClassLoader, ClassNotFoundError

from .error import ProfileSessionInactiveError
from .event_bus import Event, EventBus

LOGGER = logging.getLogger(__name__)

Expand All @@ -33,14 +30,9 @@ def __init__(
created: bool = False,
):
"""Initialize a base profile."""
context = context or InjectionContext()
scope = "profile"
if name:
scope += ":" + name
self._context = context.start_scope(scope)
self._context = context or InjectionContext()
self._created = created
self._name = name or Profile.DEFAULT_NAME
self._context.injector.bind_instance(Profile, ref(self))

@property
def backend(self) -> str:
Expand Down

0 comments on commit 16819d9

Please sign in to comment.