Repository navigation
feat: improving inquire - #4035
Merged
Merged
Conversation
Contributor
|
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
Contributor
Reviewer's GuideRefactors the inquire method to add non-interactive exit handling, streamline multiline output processing, support boolean responses for certain functions, and enable numeric fallback parsing. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey @germa89 - I've reviewed your changes - here's some feedback:
- Update the
inquiremethod docstring to mention the new None return in non-interactive mode. - Add a guard to check for an '=' in the response before splitting, to avoid unexpected
IndexError. - Include a unit test for the branch that raises on unexpected boolean output to ensure correct error handling.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Update the `inquire` method docstring to mention the new None return in non-interactive mode.
- Add a guard to check for an '=' in the response before splitting, to avoid unexpected `IndexError`.
- Include a unit test for the branch that raises on unexpected boolean output to ensure correct error handling.
## Individual Comments
### Comment 1
<location> `src/ansys/mapdl/core/mapdl_extended.py:1466` </location>
<code_context>
+
+ # Check if the function is to check existence
+ # so it makes sense to return a boolean
+ if func.upper() in ["EXIST", "WRITE", "READ", "EXEC"]:
+ if "1.0" in response:
+ return True
+ elif "0.0" in response:
+ return False
+ else:
+ raise MapdlRuntimeError(
+ f"Unexpected output from 'mapdl.inquire' function:\n{response}"
+ )
- return response
</code_context>
<issue_to_address>
String matching for boolean response may be fragile.
Using substring matching for '1.0' and '0.0' may cause incorrect results if these values appear elsewhere in the response. Use an exact match to ensure correct boolean conversion.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
…sys/pymapdl into feat/improving-inquire
germa89
enabled auto-merge (squash)
June 25, 2025 11:32
Collaborator
Author
|
@pyansys-ci-bot LGTM. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4035 +/- ##
==========================================
+ Coverage 89.05% 89.14% +0.09%
==========================================
Files 187 187
Lines 14970 14993 +23
==========================================
+ Hits 13331 13365 +34
+ Misses 1639 1628 -11 🚀 New features to boost your workflow:
|
germa89
disabled auto-merge
June 25, 2025 11:57
… file existence checks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
As the title.
Issue linked
Extracted from #1300.
Checklist
draftif it is not ready to be reviewed yet.feat: adding new MAPDL command)Summary by Sourcery
Improve the inquire method to provide typed and consistent return values, handle missing responses gracefully, and support boolean queries.
Enhancements: