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

auto-generated calculator functions stubs #25

Merged
merged 9 commits into from
Mar 27, 2024

Conversation

mariostieriansys
Copy link
Collaborator

The idea is to just import this under the variables utils and make an instance of the auto-generated class a property:

e.g.
session.ensight.utils.variables.calculator.area()

Copy link
Collaborator

@randallfrank randallfrank left a comment

Choose a reason for hiding this comment

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

I think you need one more argument to the generated functions: For example:

def area(self, source_parts: Union[List['ENS_PART'], List[int], List[str]], result_type: str = 'Compute_Per_case') -> 'ENS_VAR':

will always generate (or replace) the variable named 'Area'. IMHO, the name of the output variable (e.g. 'my_area') and the plist should be required parameters.

v = something.area("my_var", s.ensight.objs.core.PARTS)

should create a variable named "my_var" in EnSight, not always named "Area".

@mariostieriansys
Copy link
Collaborator Author

I think you need one more argument to the generated functions: For example:

def area(self, source_parts: Union[List['ENS_PART'], List[int], List[str]], result_type: str = 'Compute_Per_case') -> 'ENS_VAR':

will always generate (or replace) the variable named 'Area'. IMHO, the name of the output variable (e.g. 'my_area') and the plist should be required parameters.

v = something.area("my_var", s.ensight.objs.core.PARTS)

should create a variable named "my_var" in EnSight, not always named "Area".

@randallfrank I like the idea of passing the variable name as a parameter, but I believe it would be better to make it optional. What I have done is to build an incremental name if you don't pass the variable name.

Let's say you are computing the area

If you don't pass the argument "output_varname", it will be called Area_0, Area_1 and so on depending on how many times you call it. Otherwise it will use the passed value

@wiz-inc-572fc38784
Copy link

wiz-inc-572fc38784 bot commented Mar 26, 2024

Wiz Scan Summary

IaC Misconfigurations 0C 0H 0M 0L 0I
Vulnerabilities 0C 0H 0M 0L 0I
Sensitive Data 0C 0H 0M 0L 1I
Total 0C 0H 0M 0L 1I
Secrets 0🔑

@mariostieriansys mariostieriansys enabled auto-merge (squash) March 26, 2024 15:17
randallfrank and others added 2 commits March 26, 2024 15:36
Add more docstrings to the various variable methods.
@randallfrank randallfrank merged commit 6dbc276 into main Mar 27, 2024
6 checks passed
@randallfrank randallfrank deleted the mostieri/auto_generated_calc_functions branch March 27, 2024 13:10
mariostieriansys added a commit that referenced this pull request Mar 27, 2024
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