Skip to content
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

Add safe and complete type parsing function to type_utils, for allowing better type checking. #688

Merged
merged 3 commits into from
Mar 20, 2024

Conversation

elronbandel
Copy link
Member

No description provided.

@elronbandel elronbandel changed the title Add type parsing Add safe and complete type parsing function to type_utils, for allowing better type checking. Mar 19, 2024
Copy link

codecov bot commented Mar 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.63%. Comparing base (d0a1243) to head (64e37f0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #688      +/-   ##
==========================================
+ Coverage   89.59%   89.63%   +0.04%     
==========================================
  Files          92       92              
  Lines        8887     8928      +41     
==========================================
+ Hits         7962     8003      +41     
  Misses        925      925              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

allowd_sub_strings = list(context.keys()) + allowed_tokens
if is_made_of_sub_strings(expression, allowd_sub_strings):
return eval(expression, {"__builtins__": {}}, context)
raise ValueError(f"Unreocgnized Expression: {expression}")
Copy link
Member

@yoavkatz yoavkatz Mar 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a more informative message.

The expression '{expression} can not be evaluated because it contains tokens outside the allowed list of ...."

Signed-off-by: Elron Bandel <elron.bandel@ibm.com>
Signed-off-by: Elron Bandel <elron.bandel@ibm.com>
Signed-off-by: Elron Bandel <elron.bandel@ibm.com>
@yoavkatz yoavkatz enabled auto-merge (rebase) March 20, 2024 13:13
@yoavkatz yoavkatz merged commit 841cb58 into main Mar 20, 2024
8 checks passed
@elronbandel elronbandel deleted the add-type-parsing branch April 8, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants