Skip to content

Commit

Permalink
Merge with main.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderlazarev0 committed Jan 9, 2025
2 parents 0f6c1a7 + f275a24 commit 1a6ff65
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 58 deletions.
24 changes: 0 additions & 24 deletions tests/test_deprecated.py

This file was deleted.

6 changes: 0 additions & 6 deletions that_depends/container.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import inspect
import typing
import warnings
from contextlib import AsyncExitStack, ExitStack, asynccontextmanager, contextmanager

from that_depends.meta import BaseContainerMeta
Expand Down Expand Up @@ -100,11 +99,6 @@ async def init_resources(cls) -> None:
for container in cls.get_containers():
await container.init_resources()

@classmethod
async def init_async_resources(cls) -> None:
warnings.warn("init_async_resources is deprecated, use init_resources instead", RuntimeWarning, stacklevel=1)
await cls.init_resources()

@classmethod
async def tear_down(cls) -> None:
for provider in reversed(cls.get_providers().values()):
Expand Down
5 changes: 1 addition & 4 deletions that_depends/providers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
from that_depends.providers.base import AbstractProvider, AttrGetter
from that_depends.providers.collection import Dict, List
from that_depends.providers.context_resources import (
AsyncContextResource,
ContextResource,
DIContextMiddleware,
container_context,
)
from that_depends.providers.factories import AsyncFactory, Factory
from that_depends.providers.object import Object
from that_depends.providers.resources import AsyncResource, Resource
from that_depends.providers.resources import Resource
from that_depends.providers.selector import Selector
from that_depends.providers.singleton import AsyncSingleton, Singleton


__all__ = [
"AbstractProvider",
"AsyncContextResource",
"AsyncFactory",
"AsyncResource",
"AsyncSingleton",
"AttrGetter",
"ContextResource",
Expand Down
12 changes: 0 additions & 12 deletions that_depends/providers/context_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import inspect
import logging
import typing
import warnings
from abc import abstractmethod
from contextlib import AbstractAsyncContextManager, AbstractContextManager
from contextvars import ContextVar, Token
Expand Down Expand Up @@ -324,17 +323,6 @@ def _sync_inner(*args: P.args, **kwargs: P.kwargs) -> T_co:
return _sync_inner


class AsyncContextResource(ContextResource[T_co]):
def __init__(
self,
creator: typing.Callable[P, typing.AsyncIterator[T_co]],
*args: P.args,
**kwargs: P.kwargs,
) -> None:
warnings.warn("AsyncContextResource is deprecated, use ContextResource instead", RuntimeWarning, stacklevel=1)
super().__init__(creator, *args, **kwargs)


class DIContextMiddleware:
def __init__(self, app: ASGIApp) -> None:
self.app: typing.Final = app
Expand Down
12 changes: 0 additions & 12 deletions that_depends/providers/resources.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import typing
import warnings

from that_depends.entities.resource_context import ResourceContext
from that_depends.providers.base import AbstractResource, ResourceCreatorType
Expand Down Expand Up @@ -35,14 +34,3 @@ def _fetch_context(self) -> ResourceContext[T_co]:

async def tear_down(self) -> None:
await self._fetch_context().tear_down()


class AsyncResource(Resource[T_co]):
def __init__(
self,
creator: typing.Callable[P, typing.AsyncIterator[T_co]],
*args: P.args,
**kwargs: P.kwargs,
) -> None:
warnings.warn("AsyncResource is deprecated, use Resource instead", RuntimeWarning, stacklevel=1)
super().__init__(creator, *args, **kwargs)

0 comments on commit 1a6ff65

Please sign in to comment.