Skip to content

Commit

Permalink
update packages and format
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnik512 committed Nov 23, 2024
1 parent 7df288d commit bef2a6e
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 20 deletions.
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ ignore = [
"S101", # allow asserts
"TCH", # ignore flake8-type-checking
"FBT", # allow boolean args
"ANN101", # missing-type-self
"ANN102", # missing-type-cls
"D203", # "one-blank-line-before-class" conflicting with D211
"D213", # "multi-line-summary-second-line" conflicting with D212
"COM812", # flake8-commas "Trailing comma missing"
Expand Down
6 changes: 3 additions & 3 deletions that_depends/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@


__all__ = [
"BaseContainer",
"Provide",
"container_context",
"fetch_context_item",
"providers",
"BaseContainer",
"inject",
"Provide",
"providers",
]
2 changes: 1 addition & 1 deletion that_depends/entities/resource_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class ResourceContext(typing.Generic[T_co]):
__slots__ = "context_stack", "instance", "asyncio_lock", "threading_lock", "is_async"
__slots__ = "asyncio_lock", "context_stack", "instance", "is_async", "threading_lock"

def __init__(self, is_async: bool) -> None:
"""Create a new ResourceContext instance.
Expand Down
2 changes: 1 addition & 1 deletion that_depends/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"AsyncContextResource",
"AsyncFactory",
"AsyncResource",
"AsyncSingleton",
"AttrGetter",
"ContextResource",
"DIContextMiddleware",
Expand All @@ -28,6 +29,5 @@
"Resource",
"Selector",
"Singleton",
"AsyncSingleton",
"container_context",
]
2 changes: 1 addition & 1 deletion that_depends/providers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _get_value_from_object_by_dotted_path(obj: typing.Any, path: str) -> typing.
class AttrGetter(
AbstractProvider[T_co],
):
__slots__ = "_provider", "_attrs"
__slots__ = "_attrs", "_provider"

def __init__(self, provider: AbstractProvider[T_co], attr_name: str) -> None:
super().__init__()
Expand Down
8 changes: 4 additions & 4 deletions that_depends/providers/context_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class container_context( # noqa: N801
When used as sync-context-manager, it will only allow setup & teardown of sync resources.
"""

__slots__ = "_initial_context", "_context_token"
__slots__ = "_context_token", "_initial_context"

def __init__(self, initial_context: ContextType | None = None) -> None:
self._initial_context: ContextType = initial_context or {}
Expand Down Expand Up @@ -141,12 +141,12 @@ def fetch_context_item(key: str, default: typing.Any = None) -> typing.Any: # n

class ContextResource(AbstractResource[T_co]):
__slots__ = (
"_is_async",
"_creator",
"_args",
"_creator",
"_internal_name",
"_is_async",
"_kwargs",
"_override",
"_internal_name",
)

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions that_depends/providers/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def sync_provider(self) -> typing.Callable[[], T_co]:


class Factory(AbstractFactory[T_co]):
__slots__ = "_factory", "_args", "_kwargs", "_override"
__slots__ = "_args", "_factory", "_kwargs", "_override"

def __init__(self, factory: typing.Callable[P, T_co], *args: P.args, **kwargs: P.kwargs) -> None:
super().__init__()
Expand Down Expand Up @@ -55,7 +55,7 @@ def sync_resolve(self) -> T_co:


class AsyncFactory(AbstractFactory[T_co]):
__slots__ = "_factory", "_args", "_kwargs", "_override"
__slots__ = "_args", "_factory", "_kwargs", "_override"

def __init__(self, factory: typing.Callable[P, typing.Awaitable[T_co]], *args: P.args, **kwargs: P.kwargs) -> None:
super().__init__()
Expand Down
6 changes: 3 additions & 3 deletions that_depends/providers/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

class Resource(AbstractResource[T_co]):
__slots__ = (
"_is_async",
"_creator",
"_args",
"_context",
"_creator",
"_is_async",
"_kwargs",
"_override",
"_context",
)

def __init__(
Expand Down
2 changes: 1 addition & 1 deletion that_depends/providers/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class Selector(AbstractProvider[T_co]):
__slots__ = "_selector", "_providers", "_override"
__slots__ = "_override", "_providers", "_selector"

def __init__(self, selector: typing.Callable[[], str], **providers: AbstractProvider[T_co]) -> None:
super().__init__()
Expand Down
4 changes: 2 additions & 2 deletions that_depends/providers/singleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class Singleton(AbstractProvider[T_co]):
__slots__ = "_factory", "_args", "_kwargs", "_override", "_instance", "_asyncio_lock", "_threading_lock"
__slots__ = "_args", "_asyncio_lock", "_factory", "_instance", "_kwargs", "_override", "_threading_lock"

def __init__(self, factory: typing.Callable[P, T_co], *args: P.args, **kwargs: P.kwargs) -> None:
super().__init__()
Expand Down Expand Up @@ -72,7 +72,7 @@ async def tear_down(self) -> None:


class AsyncSingleton(AbstractProvider[T_co]):
__slots__ = "_factory", "_args", "_kwargs", "_override", "_instance", "_asyncio_lock"
__slots__ = "_args", "_asyncio_lock", "_factory", "_instance", "_kwargs", "_override"

def __init__(self, factory: typing.Callable[P, typing.Awaitable[T_co]], *args: P.args, **kwargs: P.kwargs) -> None:
super().__init__()
Expand Down

0 comments on commit bef2a6e

Please sign in to comment.