Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Merge commit 'fec726d332a32994800159ac68ed7456abff9188' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
yashikno committed Aug 8, 2022
2 parents 8cbf557 + fec726d commit c4f24cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions nexus_constructor/model/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
CHILD_EXCLUDELIST = [TRANSFORMS_GROUP_NAME]


def create_list_of_possible_streams():
return [module.value for module in StreamModules]


@attr.s
class Group:
"""
Expand All @@ -41,7 +45,7 @@ class Group:
attributes = attr.ib(type=Attributes, factory=Attributes, init=False)
values = None
possible_stream_modules = attr.ib(
type=List[str], default=[module.value for module in StreamModules]
type=List[str], default=attr.Factory(create_list_of_possible_streams)
)
_group_placeholder: bool = False

Expand Down Expand Up @@ -181,13 +185,15 @@ def as_dict(self, error_collector: List[str]) -> Dict[str, Any]:
return return_dict

def set_possible_stream_modules(self, possible_stream_modules: List[str]):
self.possible_stream_modules = possible_stream_modules
self.possible_stream_modules = possible_stream_modules.copy()

def get_possible_stream_modules(self) -> List[str]:
return self.possible_stream_modules
return self.possible_stream_modules.copy()

def add_stream_module(self, module: str):
if module not in self.possible_stream_modules:
if module not in self.possible_stream_modules and module in [
module.value for module in StreamModules
]:
self._modify_possible_streams(module, self.possible_stream_modules.append)

def remove_stream_module(self, module: str):
Expand Down
2 changes: 1 addition & 1 deletion nexus_constructor/stream_fields_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ def update_existing_stream_info(self, field):
:param field: The stream group
"""
if not field:
raise TypeError("Field is NoneType when " "expecting type StreamModule.")
raise TypeError("Field is NoneType when expecting type StreamModule.")
if isinstance(field, Group):
field = field.children[0]
if hasattr(field, "parent_node") and isinstance(field.parent_node, Group):
Expand Down

0 comments on commit c4f24cc

Please sign in to comment.