Skip to content

Commit

Permalink
Release version 1.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
raceychan committed Feb 3, 2025
1 parent 894c58a commit 907b9ff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -954,11 +954,11 @@ and such override won't affect others.
The general rule is that scope can access registered singletons and resolved instances but not vice versa.
## version 1.3.6
- Fix: `Graph.entry` no longer uses existing scope, instead, always create a new scope
## version 1.3.7
- a quick fix to the previous quick fix in 1.3.4, guess the fix was too quick ;)
2 changes: 1 addition & 1 deletion ididi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
license: MIT, see LICENSE for more details.
"""

VERSION = "1.3.6"
VERSION = "1.3.7"

__version__ = VERSION

Expand Down
20 changes: 7 additions & 13 deletions ididi/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class SharedData(TypedDict):
nodes: GraphNodes
resolved_nodes: dict[Hashable, DependentNode[Any]]
type_registry: TypeRegistry
# registered_singletons: set[type]
ignore: GraphIgnore


Expand Down Expand Up @@ -981,9 +982,8 @@ def __init__(
self,
*,
graph_resolutions: ResolvedSingletons[Any],
graph_singletons: set[type],
registered_singletons: set[type],
resolved_singletons: ResolvedSingletons[Any],
registered_singletons: set[type],
name: Maybe[Hashable] = MISSING,
pre: Maybe[Union["SyncScope", "AsyncScope"]] = MISSING,
**args: Unpack[SharedData],
Expand All @@ -992,11 +992,10 @@ def __init__(
self._pre = pre
self._stack = ExitStack()
self._graph_resolutions = graph_resolutions
self._graph_singletons = graph_singletons
super().__init__(
**args,
registered_singletons=registered_singletons,
resolved_singletons=resolved_singletons,
registered_singletons=registered_singletons,
)

def __enter__(self) -> "SyncScope":
Expand Down Expand Up @@ -1049,9 +1048,8 @@ def __init__(
self,
*,
graph_resolutions: ResolvedSingletons[Any],
graph_singletons: set[type],
registered_singletons: set[type],
resolved_singletons: ResolvedSingletons[Any],
registered_singletons: set[type],
name: Maybe[Hashable] = MISSING,
pre: Maybe[Union["SyncScope", "AsyncScope"]] = MISSING,
**args: Unpack[SharedData],
Expand All @@ -1060,12 +1058,11 @@ def __init__(
self._pre = pre
self._stack = AsyncExitStack()
self._graph_resolutions = graph_resolutions
self._graph_singletons = graph_singletons

super().__init__(
**args,
registered_singletons=registered_singletons,
resolved_singletons=resolved_singletons,
registered_singletons=registered_singletons,
)

async def __aenter__(self) -> "AsyncScope":
Expand Down Expand Up @@ -1163,11 +1160,9 @@ def __init__(
self._token: Maybe[ScopeToken] = MISSING

def create_scope(self, previous_scope: Maybe[Union[SyncScope, AsyncScope]]):

return SyncScope(
graph_resolutions=self.graph_resolutions,
graph_singletons=self.graph_singletons,
registered_singletons=set(),
registered_singletons=self.graph_singletons.copy(),
resolved_singletons=dict(),
name=self.name,
pre=previous_scope,
Expand All @@ -1177,8 +1172,7 @@ def create_scope(self, previous_scope: Maybe[Union[SyncScope, AsyncScope]]):
def create_ascope(self, previous_scope: Maybe[Union[SyncScope, AsyncScope]]):
return AsyncScope(
graph_resolutions=self.graph_resolutions,
graph_singletons=self.graph_singletons,
registered_singletons=set(),
registered_singletons=self.graph_singletons.copy(),
resolved_singletons=dict(),
name=self.name,
pre=previous_scope,
Expand Down

0 comments on commit 907b9ff

Please sign in to comment.