bridge.pipelines.bt2gh_for_pr_issues.map_funcs.functions module#
Map function annotations from bio.tools to GitHub.
This module compares the function annotations recorded in bio.tools with the GitHub README and, when appropriate, proposes a GitHub issue suggesting that the bio.tools function annotations be added to the README.
- bridge.pipelines.bt2gh_for_pr_issues.map_funcs.functions.map_functions(gh_readme, bt_functions)[source]#
Propose a GitHub issue to add function annotations based on bio.tools metadata.
Steps performed: 1. Check if the README already mentions functions using the FUNCTION_PATTERN.
If it does, no issue is needed.
If no functions are found in bio.tools, no issue is needed.
- If functions are present in bio.tools but not mentioned in the README, build
a function string for each function and propose an issue to add them to the README.
- Parameters:
gh_readme (str | None) – The current README content from GitHub, or
Noneif the file does not exist yet.bt_functions (list[FunctionItem] | None) – The list of FunctionItems from bio.tools metadata, or
Noneif no functions are defined.
- Returns:
A dictionary with the issue title as key and the issue body as value, or
Noneif no issue is to be created.- Return type:
dict[str, str] | None
- bridge.pipelines.bt2gh_for_pr_issues.map_funcs.functions.map_functions_to_readme(gh_readme, bt_functions)[source]#
Propose an updated README content by adding function annotations from bio.tools metadata.
Steps performed: 1. Check if README exists; if not, no update is needed. 2. Check if the README already mentions functions using the FUNCTION_PATTERN.
If it does not, no update is needed.
If no functions are found in bio.tools, no update is needed.
- If functions are present in bio.tools and the README mentions functions,
remove all existing function blocks from the README.
- In their place, add new function blocks for each function from bio.tools.
The new function blocks are built using the FUNCTION_TEMPLATE and the function data from bio.tools.
This function is intended to be used in the construction of a README update for a PR, where the updated README content is proposed directly rather than suggesting the update via an issue. See readme module for the usage of this function in the context of a README update.
- Parameters:
gh_readme (str | None) – The current README content from GitHub, or
Noneif the file does not exist yet.bt_functions (list[FunctionItem] | None) – The list of FunctionItems from bio.tools metadata, or
Noneif no functions are defined.
- Returns:
The updated README content with function annotations added, or the original README content if no update is needed.
- Return type:
str | None