-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace enrichment of context with template filters
- Loading branch information
1 parent
31fb807
commit 8750018
Showing
10 changed files
with
116 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
..._forge/partials/example-algorithm/example-algorithm{{cookiecutter._}}/requirements.txt.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{% if cookiecutter.phase.has_input_image or cookiecutter.phase.has_output_image -%} | ||
{% if cookiecutter.phase.inputs | has_image or cookiecutter.phase.outputs | has_image -%} | ||
SimpleITK | ||
numpy | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...example-evaluation-method/example-evaluation-method{{cookiecutter._}}/requirements.txt.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{% if cookiecutter.phase.has_input_image or cookiecutter.phase.has_output_image -%} | ||
{% if cookiecutter.phase.inputs | has_image or cookiecutter.phase.outputs | has_image -%} | ||
SimpleITK | ||
numpy | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,48 @@ | ||
from cookiecutter.utils import simple_filter | ||
|
||
from grand_challenge_forge.utils import extract_slug as util_extract_slug | ||
from grand_challenge_forge import generation_utils | ||
|
||
custom_filters = [] | ||
|
||
@simple_filter | ||
|
||
def register_simple_filter(func): | ||
func = simple_filter(func) | ||
custom_filters.append( | ||
f"grand_challenge_forge.partials.filters.{func.__name__}" | ||
) | ||
return func | ||
|
||
|
||
@register_simple_filter | ||
def extract_slug(url): | ||
return util_extract_slug(url) | ||
return generation_utils.extract_slug(url) | ||
|
||
|
||
@register_simple_filter | ||
def is_json(arg): | ||
return generation_utils.is_json(arg) | ||
|
||
|
||
@register_simple_filter | ||
def has_json(arg): | ||
return any(generation_utils.is_json(item) for item in arg) | ||
|
||
|
||
@register_simple_filter | ||
def is_image(arg): | ||
return generation_utils.is_image(arg) | ||
|
||
|
||
@register_simple_filter | ||
def has_image(arg): | ||
return any(generation_utils.is_image(item) for item in arg) | ||
|
||
|
||
@register_simple_filter | ||
def is_file(arg): | ||
return generation_utils.is_file(arg) | ||
|
||
|
||
@register_simple_filter | ||
def has_file(arg): | ||
return any(generation_utils.is_file(item) for item in arg) |
Oops, something went wrong.