fix: Correct PSE001 validation for Python literals and empty enumerations#512
Open
VDobranov wants to merge 53 commits intobuildingSMART:developmentfrom
Open
fix: Correct PSE001 validation for Python literals and empty enumerations#512VDobranov wants to merge 53 commits intobuildingSMART:developmentfrom
VDobranov wants to merge 53 commits intobuildingSMART:developmentfrom
Conversation
This reverts commit 4581f26.
* disable BRP001 * disable TAS001
* Fix SWE001 * Version bump --------- Co-authored-by: Thomas Krijnen <[email protected]>
* Add material/profile properties to whitelisted inverses buildingSMART#356 * Update scenario text and version bump * Also fix IfcMaterialDefinitionRepresentation
…tion - Использовать ast.literal_eval вместо json.loads для Python-литералов - Пустой список значений в template означает 'любое значение допустимо' - Исправляет ошибки валидации PSE001 для Pset_ElementComponentCommon Co-authored-by: Qwen-Coder <[email protected]>
Collaborator
|
Hi, maybe you shared this elsewhere but do you have an example file that triggers this behaviour? |
Author
Hi! Sure, I'm adding the file (don't see anything special about it, though): Also, here are two results (before and after fix) of the command: I am a bit unsure whether it is AI's voodoo or genuine bug, but according to my tests it seems legit. |
modified: features/steps/utils/geometry.py
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.
For Info
The fix was created with the help of Qwen AI.
Summary
This PR fixes two bugs in the PSE001 validation rule that caused false positive errors when validating IFC files with
Pset_ElementComponentCommon.Issues Fixed
Bug 1: CSV parsing error for Python literals
File:
features/steps/steps/propertysets_qtys_units.py, functionmake_obj()Problem: The parser used
json.loads(s.replace("'", '"'))to parse Python dictionary literals frompset_definitions.csv. This failed for Python constants likeNone,True,Falsewhich are not valid JSON.Error message:
Fix: Use
ast.literal_eval()for proper Python literal parsing, with fallback to JSON parsing for compatibility:Bug 2: Empty enumeration values validation
File:
features/steps/steps/propertysets_qtys_units.py, functionstep_impl()Problem: Empty values list
values: []in pset template was interpreted as "only empty value allowed", but should mean "any value is accepted" (open enumeration).Error message:
Fix: Skip validation when
accepted_data_type['values']is empty: