Skip to content

Commit

Permalink
Merge pull request #74 from intezer/feature/docs
Browse files Browse the repository at this point in the history
docs: add documentation to some classes
  • Loading branch information
davidt99 authored Jan 23, 2023
2 parents bd5dd2a + 3b22f88 commit 54070d6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion intezer_sdk/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self,
:param disable_static_unpacking: A flag to disable static unpacking during analysis.
:param api: The API connection to Intezer.
:param file_name: The name of the file.
:param code_item_type: The type of the file, either "file" or "memory module".
:param code_item_type: The type of the file, either "file" or "memory_module".
:param zip_password: The password for a password-protected zip file.
:param download_url: A URL from which to download the file to be analyzed.
:param sandbox_command_line_arguments: The command line arguments for sandbox analysis.
Expand Down
5 changes: 5 additions & 0 deletions intezer_sdk/endpoint_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ def _query_status_from_api(self):
return self._api.get_endpoint_analysis_response(self.analysis_id, False)

def get_sub_analyses(self, verdicts: List[str] = None) -> List[SubAnalysis]:
"""
Get the sub_analyses of the current analysis.
:param verdicts: A list of the verdicts to filter by.
:return: A list of SubAnalysis objects.
"""
self._assert_analysis_finished()
if not self._sub_analyses:
self._init_sub_analyses()
Expand Down
14 changes: 14 additions & 0 deletions intezer_sdk/sub_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@


class SubAnalysis:
"""
SubAnalysis is a class representing a sub-analysis object in an Intezer API.
"""
def __init__(self,
analysis_id: str,
composed_analysis_id: str,
Expand All @@ -37,6 +40,17 @@ def from_analysis_id(cls,
composed_analysis_id: str,
lazy_load=True,
api: IntezerApi = None) -> Optional['SubAnalysis']:
"""
class method that creates a new instance of the class by fetching the details of the sub-analysis from the Intezer API.
If lazy_load is set to True, the details of the sub-analysis are not fetched immediately.
If lazy_load is set to False, the details of the sub-analysis are fetched immediately.
Returns None when analysis doesn't exist.
:param analysis_id: The ID of the analysis to retrieve.
:param composed_analysis_id: The ID of the parent analysis to retrieve.
:param lazy_load: bool indicating if the details of the sub-analysis should be fetched immediately or not
:param api: The API connection to Intezer.
:return: A SubAnalysis instance with the given analysis ID.
"""
sub_analysis = cls(analysis_id, composed_analysis_id, '', '', None, api)
if not lazy_load:
try:
Expand Down

0 comments on commit 54070d6

Please sign in to comment.