-
Notifications
You must be signed in to change notification settings - Fork 1
Standardize None argument handling using check_and_coerce_optional helper #49
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
base: main
Are you sure you want to change the base?
Conversation
… across codebase Co-authored-by: osinjoku <49887472+osinjoku@users.noreply.github.com>
Co-authored-by: osinjoku <49887472+osinjoku@users.noreply.github.com>
|
@copilot check the build failure |
…k to fail Co-authored-by: osinjoku <49887472+osinjoku@users.noreply.github.com>
Fixed the build failure. The issue was an indentation error in mesh_editor.py at line 745 caused by the automated refactoring script. The script incorrectly handled a case where there's conditional logic based on whether a parameter is None (calling different COM methods). Fixed in commit fe6565e. |
|
@copilot Consider including the coerce_optional_dispatch call part of the none checks,. Check first if this pattern is consistent across all the parameters that we are doing the none check for, ensure that we are also calling coerce_optional_dispatch on them |
I've verified the pattern consistency across all 21 modified files: Results:
Pattern:
All parameters using The pattern is fully consistent - every optional COM object parameter is validated with |
|
@copilot I think the coerce_optional_dispatch calls should be part of check_optional_types function (rename the function name appropriately) |
…ction Co-authored-by: sankalps0549 <230025240+sankalps0549@users.noreply.github.com>
Implemented in commit 7d1084e. Created a new Changes:
Example: # Old pattern (2 calls)
check_optional_type(nodes, EntList)
return self.method(coerce_optional_dispatch(nodes, "ent_list"))
# New pattern (1 call)
return self.method(check_and_coerce_optional(nodes, EntList))The function automatically handles primitives (returned as-is) vs COM objects (attribute unwrapped). |
Co-authored-by: sankalps0549 <230025240+sankalps0549@users.noreply.github.com>
|
@copilot please intelligently resolve the merge conflicts and explain why you made the decision that you make |
Resolved merge conflict by accepting removal of GradingFactor enum from main branch. The enum was correctly removed because it restricted the cad_mesh_grading_factor property to discrete values when the COM API supports continuous float values (0.0-1.0). Changes from main branch: - Removed GradingFactor enum (incorrectly restricted API) - Updated MeshGenerator.cad_mesh_grading_factor to accept float values - Added proper range validation (0.0 to 1.0) - Updated CHANGELOG.md to document the breaking change - Removed grading_factor.rst documentation - Added Python 3.14 support Co-authored-by: osinjoku <49887472+osinjoku@users.noreply.github.com>
|
@copilot fix the build again |
Co-authored-by: osinjoku <49887472+osinjoku@users.noreply.github.com>
Fixed in commit 85263ff. The build was failing due to Black formatting violations in 19 files. All files have been reformatted to meet the project's code style requirements (line-length=100, skip-string-normalization, skip-magic-trailing-comma). |
|
@copilot fix the build again |
Co-authored-by: osinjoku <49887472+osinjoku@users.noreply.github.com>
Fixed in commit 7da0baf. The build was failing due to pylint errors:
All import issues have been resolved. |
|
@copilot fix the build again |
|
@osinjoku Can we maybe close this PR and restart the process, the PR was opened on Dec 12th, and the branch is outdated. |
|
@copilot Please merge the main branch into the current to bring it up to date. Also please run the lint command before making commits. |
…one-argument-handling
- Merged latest main branch to bring the PR up to date - Fixed Black formatting violations in 6 files - All linting checks pass (9.94/10 rating) Co-authored-by: sankalps0549 <230025240+sankalps0549@users.noreply.github.com>
Completed in commit c2df0d6. The branch is now up-to-date with main and all lint checks pass (9.94/10 rating). Changes:
The pylint import warnings for Windows modules ( |
|
@copilot Build failed due to failing tests. Fix them |
The tests cannot run locally because this codebase requires Windows-specific modules ( Local verification completed:
The tests will run properly in the Windows CI environment. Could you share the specific test failure messages from the CI run so I can address them? |
|
@copilot Tests are failing for |
Fixed failing tests for TestHelper.test_check_optional_type_invalid where None was incorrectly included in the test parameters. Since check_optional_type explicitly allows None values, the test should only verify that non-None invalid types raise TypeError. Changes: - Added `if x is not None` filter to test parametrization - Prevents None from being tested as an invalid value - Aligns test expectations with function behavior Co-authored-by: sankalps0549 <230025240+sankalps0549@users.noreply.github.com>
Fixed in commit 8f6b3fd. The issue was that Added |
Description
Standardizes handling of None arguments across the codebase by introducing a
check_and_coerce_optional()helper that combines type validation and COM coercion into a single operation, eliminating 423 redundant two-step patterns.Before:
After:
Changes
check_and_coerce_optional(value, expected_type)tohelper.py- combines type validation and COM coercion into a single operationboundary_conditions,modeler,mesh_editor,diagnosis_manager,plot_manager,user_plot,viewer, and otherscheck_type()andcheck_optional_type()to accepttuple | typemesh_editor.pycaused by automated refactoringType of change
Checklist
Testing
Added comprehensive unit tests for
check_and_coerce_optional()covering:Test Fix:
Fixed
test_check_optional_type_invalidto properly exclude None values from invalid type tests, sincecheck_optional_typeexplicitly allows None as valid input.Additional Notes
coerce_optional_dispatchstill available for direct usepython run.py lint)Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.