-
Notifications
You must be signed in to change notification settings - Fork 0
Add function to keyword parser #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new function _get_function_keywords to parse function signatures and translate parameter information, where positional-only arguments are represented as numeric indices and other arguments are represented by their names.
- Added
_get_function_keywordsfunction that inspects function signatures and returns parameter representations - Added corresponding unit test to verify the function behavior with different parameter types
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| flowrep/workflow.py | Implements the new _get_function_keywords function using inspect module |
| tests/unit/test_workflow.py | Adds unit test for the new function with positional-only, regular, and keyword-only parameters |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
flowrep/workflow.py
Outdated
| } | ||
|
|
||
|
|
||
| def _get_function_keywords(function: Callable) -> dict[str, Any]: |
Copilot
AI
Sep 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function name _get_function_keywords is misleading since it returns a list, not just keywords. The return type annotation should be list[Union[int, str]] instead of dict[str, Any] to accurately reflect that it returns a list containing either integers (for positional-only params) or strings (for named params).
| items.append(ii) | ||
| else: | ||
| items.append(name) | ||
| return items |
Copilot
AI
Sep 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function returns a list but the type annotation indicates dict[str, Any]. This mismatch will cause type checking issues. Change the return type to list[Union[int, str]] to match the actual return value.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## minimal #31 +/- ##
===========================================
- Coverage 96.29% 96.17% -0.12%
===========================================
Files 2 2
Lines 593 602 +9
===========================================
+ Hits 571 579 +8
- Misses 22 23 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Based on today's discussion, I implemented a function to translate input arguments to the names, while the positional only arguments are translated to numbers