Skip to content

Commit

Permalink
use NFCORE_PIPELINE as a boolean instead of a PIPELINE_TYPE string
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol committed May 30, 2024
1 parent 6275553 commit 2b724e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions nf_core/pipelines/create/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PipelineCreateApp(App[utils.CreateConfig]):
TEMPLATE_CONFIG = utils.CreateConfig()

# Initialise pipeline type
PIPELINE_TYPE = None
NFCORE_PIPELINE = True

# Log handler
LOG_HANDLER = log_handler
Expand All @@ -74,12 +74,12 @@ def on_button_pressed(self, event: Button.Pressed) -> None:
if event.button.id == "start":
self.push_screen("choose_type")
elif event.button.id == "type_nfcore":
self.PIPELINE_TYPE = "nfcore"
utils.PIPELINE_TYPE_GLOBAL = "nfcore"
self.NFCORE_PIPELINE = True
utils.NFCORE_PIPELINE_GLOBAL = True
self.push_screen("basic_details")
elif event.button.id == "type_custom":
self.PIPELINE_TYPE = "custom"
utils.PIPELINE_TYPE_GLOBAL = "custom"
self.NFCORE_PIPELINE = False
utils.NFCORE_PIPELINE_GLOBAL = False
self.push_screen("basic_details")
elif event.button.id == "continue":
self.push_screen("final_details")
Expand Down
8 changes: 4 additions & 4 deletions nf_core/pipelines/create/basicdetails.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def compose(self) -> ComposeResult:
"GitHub organisation",
"nf-core",
classes="column",
disabled=self.parent.PIPELINE_TYPE == "nfcore",
disabled=self.parent.NFCORE_PIPELINE,
)
yield TextInput(
"name",
Expand Down Expand Up @@ -85,7 +85,7 @@ def on_screen_resume(self):
add_hide_class(self.parent, "exist_warn")
for text_input in self.query("TextInput"):
if text_input.field_id == "org":
text_input.disabled = self.parent.PIPELINE_TYPE == "nfcore"
text_input.disabled = self.parent.NFCORE_PIPELINE

@on(Button.Pressed)
def on_button_pressed(self, event: Button.Pressed) -> None:
Expand All @@ -102,9 +102,9 @@ def on_button_pressed(self, event: Button.Pressed) -> None:
try:
self.parent.TEMPLATE_CONFIG = CreateConfig(**config)
if event.button.id == "next":
if self.parent.PIPELINE_TYPE == "nfcore":
if self.parent.NFCORE_PIPELINE:
self.parent.push_screen("type_nfcore")
elif self.parent.PIPELINE_TYPE == "custom":
else:
self.parent.push_screen("type_custom")
except ValueError:
pass
4 changes: 2 additions & 2 deletions nf_core/pipelines/create/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def init_context(value: Dict[str, Any]) -> Iterator[None]:


# Define a global variable to store the pipeline type
PIPELINE_TYPE_GLOBAL: Union[str, None] = None
NFCORE_PIPELINE_GLOBAL: bool = True


class CreateConfig(BaseModel):
Expand Down Expand Up @@ -148,7 +148,7 @@ def validate(self, value: str) -> ValidationResult:
If it fails, return the error messages."""
try:
with init_context({"is_nfcore": PIPELINE_TYPE_GLOBAL == "nfcore"}):
with init_context({"is_nfcore": NFCORE_PIPELINE_GLOBAL}):
CreateConfig(**{f"{self.key}": value})
return self.success()
except ValidationError as e:
Expand Down

0 comments on commit 2b724e0

Please sign in to comment.