Skip to content

Commit

Permalink
remove deprecated (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnik512 authored Jan 9, 2025
1 parent efde61d commit f275a24
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 contextmanager

from that_depends.providers import AbstractProvider, Resource, Singleton
Expand Down Expand Up @@ -57,11 +56,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.collections 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 @@ -2,7 +2,6 @@
import logging
import typing
import uuid
import warnings
from contextlib import AbstractAsyncContextManager, AbstractContextManager
from contextvars import ContextVar, Token
from functools import wraps
Expand Down Expand Up @@ -166,14 +165,3 @@ def _fetch_context(self) -> ResourceContext[T_co]:
resource_context = ResourceContext(is_async=_is_container_context_async())
container_context.setdefault(self._internal_name, resource_context)
return resource_context


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)
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 @@ -33,14 +32,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 f275a24

Please sign in to comment.