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

feat(restapi): added signature analysis workflow endpoint & tests #719

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

jtsextonMITRE
Copy link
Collaborator

Closes #691

Copy link
Collaborator

@keithmanville keithmanville left a comment

Choose a reason for hiding this comment

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

Want to have a discussion to make sure we are capturing the types how we want in the output.

src/dioptra/restapi/v1/workflows/schema.py Show resolved Hide resolved
src/dioptra/restapi/v1/workflows/service.py Show resolved Hide resolved
src/dioptra/client/workflows.py Show resolved Hide resolved
json_={"filename": filename, "fileContents": fileContents},
)

def signature_analysis_file(self, filename: str) -> T:
Copy link
Collaborator

Choose a reason for hiding this comment

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

instead of having separate methods, can we overload a single method and either read from file or from contents depending on which args are passed?

This was the guidance James gave me for my import workflow. See here for an example:

Function signature information data structures, as dicts
"""
if filepath:
ast = ast_module.parse(python_source, filename=filepath, feature_version=(3, 9))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change to feature_version=sys.version_info[0:2] so this stays current to the version of python we are using.

We are currently using 3.11 in the worker containers if for some reason we don't want to stick to the version of python being used to run the function.

if filepath:
ast = ast_module.parse(python_source, filename=filepath, feature_version=(3, 9))
else:
ast = ast_module.parse(python_source, feature_version=(3, 9))
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as line 687

Copy link
Collaborator

Choose a reason for hiding this comment

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

why are these files in examples showing as changed?

@@ -78,3 +83,36 @@ def get(self):
mimetype=mimetype[parsed_query_params["file_type"]],
download_name=download_name[parsed_query_params["file_type"]],
)


@api.route("/signatureAnalysis")
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want to be more descriptive with the endpoint name? taskPluginSignatureAnalysis?

would need the same change in the client.

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.

Add a plugin task type inference workflow for missing types Add plugin task type inference workflow
4 participants