Skip to content

Commit

Permalink
fixed context manager bug
Browse files Browse the repository at this point in the history
  • Loading branch information
romanmanasipov committed May 3, 2024
1 parent 64acf5f commit e7ee1f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/petrovisor/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.1.6"
__version__ = "0.1.7"

# api
from petrovisor.petrovisor import PetroVisor
Expand Down
9 changes: 6 additions & 3 deletions src/petrovisor/models/contexts_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,14 @@ def __init__(

if len(all_contexts) == 0:
context = Context(name=default_name or "")
context.entity_set = entity_set
context.scope = scope
context.hierarchy = hierarchy
elif len(all_contexts) == 1 or primary_context.casefold() == "first":
context = all_contexts[0]
else:
context = api.merge_contexts(all_contexts)
self.name = context.name
self.entity_set = context.entity_set
self.scope = context.scope
self.hierarchy = context.hierarchy
self.entity_set = context.entity_set or entity_set
self.scope = context.scope or scope
self.hierarchy = context.hierarchy or hierarchy

0 comments on commit e7ee1f1

Please sign in to comment.