-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow filter-func in need-pie to have multiple dots in the import pat…
…h. (#1373) I just changed the split of the path of filter-func to split on the first dot starting from the right. This means anything to the right will be the function name and anything to the left will be the module import path This Fix will close the issue #1372 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4e52ed2
commit 3ba2d9e
Showing
4 changed files
with
69 additions
and
4 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
34 changes: 34 additions & 0 deletions
34
tests/doc_test/doc_needs_filter_data/module/filter_code_func.py
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
def own_filter_code(needs, results): | ||
for need in needs: | ||
if need["type"] == "test": | ||
results.append(need) | ||
|
||
|
||
def own_filter_code_args(needs, results, **kwargs): | ||
for need in needs: | ||
if need["status"] == kwargs["arg1"]: | ||
results.append(need) | ||
|
||
|
||
def my_pie_filter_code(needs, results): | ||
cnt_x = 0 | ||
cnt_y = 0 | ||
for need in needs: | ||
if need["variant"] == "project_x": | ||
cnt_x += 1 | ||
if need["variant"] == "project_y": | ||
cnt_y += 1 | ||
results.append(cnt_x) | ||
results.append(cnt_y) | ||
|
||
|
||
def my_pie_filter_code_args(needs, results, **kwargs): | ||
cnt_x = 0 | ||
cnt_y = 0 | ||
for need in needs: | ||
if need["status"] == kwargs["arg1"]: | ||
cnt_x += 1 | ||
if need["status"] == kwargs["arg2"]: | ||
cnt_y += 1 | ||
results.append(cnt_x) | ||
results.append(cnt_y) |
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