module documentation

Undocumented

Function ast_to_json Function to convert the AST object into JSON format. :param ast_obj: AST object
Function ast_to_source_code Function to convert the AST object into source code. :param ast_obj: AST object
Function call_list_dir Undocumented
Function call_list_file Undocumented
Function detect_license Function to detect the license type from extracted text.
Function DFG_python Undocumented
Function dice_coefficient dice coefficient 2nt/(na + nb).
Function extract_call_functions Undocumented
Function extract_call_methods Undocumented
Function extract_data Undocumented
Function extract_dataflow Undocumented
Function extract_directory_tree Method to obtain the directory tree of a repository. The ignored directories and files that were inputted are also ignored. :input_path path of the repo to
Function extract_license Extracts the license of the repository. Args: input_path (str): Path of the repository to be analyzed.
Function extract_local_function Undocumented
Function extract_nested_function Undocumented
Function extract_readme Function to extract content of all readme file under the input directory. :param input_path: Path of the repository to be analyzed. :param output_dir: The output directory. Used to generate the correct path of the README file.
Function extract_relations Undocumented
Function extract_requirements Undocumented
Function extract_software_invocation Method to detect the directory type of a software project. This method also detects tests We distinguish four main types: script, package, library and service. Some can be more than one. :dir_info json containing all the extracted information about the software repository :dir_tree_info json containing the directory information of the target repo :input_path path of the repository to analyze :call_list json file containing the list of calls per file and functions or methods...
Function file_in_call Undocumented
Function find_file_calls Undocumented
Function find_index_init Undocumented
Function find_module_calls Undocumented
Function generate_output_html Method to generate a simple HTML view of the obtained JSON. :pruned_json JSON to print out :output_file_html path where to write the HTML
Function get_github_metadata Function to extract metadata from the remote repository using Github api. It requires connectivity to the Github API and the local target repository to have .git folder and a remote repository on Github.
Function index_to_code_token Undocumented
Function list_functions_classes_from_module Undocumented
Function parse_module Undocumented
Function print_summary This method prints a small summary of the classes and properties recognized during the analysis. At the moment this method is only invoked when a directory with multiple files is passed.
Function prune_json Method that given a JSON object, removes all its empty fields. This method simplifies the resultant JSON. :param json_dict input JSON file to prune :return JSON file removing empty values
Function rank_software_invocation Function to create a ranking over the different ways of executing a program. If two elements have the same position in the ranking, it means that there is no priority among them. Heuristic to order the invocation list is as follows, in decreasing order of prioritization: - If package or library is detected, this will be always first...
Function service_check Undocumented
Function service_in_set Undocumented
Function top_level_classes Undocumented
Function top_level_functions Undocumented
Function tree_to_token_index Undocumented
Function tree_to_variable_index Undocumented
Function type_module Undocumented
Function update_list_calls Undocumented
def ast_to_json(ast_obj): (source)

Function to convert the AST object into JSON format. :param ast_obj: AST object

def ast_to_source_code(ast_obj): (source)

Function to convert the AST object into source code. :param ast_obj: AST object

def call_list_dir(dir_info): (source)

Undocumented

def call_list_file(code_info): (source)

Undocumented

def detect_license(license_text, licenses_path, threshold=0.9): (source)

Function to detect the license type from extracted text. Args: license_text (str): The extracted license text. licenses_path (str): Path of the folder containing license templates. threshold (float): Threshold to consider a license as detected. A float between 0 and 1. Returns: Ranked list of license types and their percentage match to the supplied license_text.

def DFG_python(root_node, index_to_code, states): (source)

Undocumented

def dice_coefficient(a, b): (source)

dice coefficient 2nt/(na + nb).

def extract_call_functions(funcs_info, body=0): (source)

Undocumented

def extract_call_methods(classes_info): (source)

Undocumented

def extract_data(base, m_calls, file, m_imports, flag_found, call_list, orig_base, level): (source)

Undocumented

def extract_dataflow(code, parser, lang): (source)

Undocumented

def extract_directory_tree(input_path, ignore_dirs, ignore_files, visual=0): (source)

Method to obtain the directory tree of a repository. The ignored directories and files that were inputted are also ignored. :input_path path of the repo to

def extract_license(input_path): (source)

Extracts the license of the repository. Args: input_path (str): Path of the repository to be analyzed. Returns: Optional[str]: The license text Raises: Exception: If a license file is not found.

def extract_local_function(base, m_calls_local, file, m_imports, flag_found, call_list, orig_base, level): (source)

Undocumented

def extract_nested_function(base, m_calls_nested, file, m_imports, flag_found, call_list, orig_base, level): (source)

Undocumented

def extract_readme(input_path: str, output_dir: str) -> dict: (source)

Function to extract content of all readme file under the input directory. :param input_path: Path of the repository to be analyzed. :param output_dir: The output directory. Used to generate the correct path of the README file.

def extract_relations(file_name, m_calls, main_files, call_list): (source)

Undocumented

def extract_requirements(input_path): (source)

Undocumented

def extract_software_invocation(dir_info, dir_tree_info, input_path, call_list, readme): (source)

Method to detect the directory type of a software project. This method also detects tests We distinguish four main types: script, package, library and service. Some can be more than one. :dir_info json containing all the extracted information about the software repository :dir_tree_info json containing the directory information of the target repo :input_path path of the repository to analyze :call_list json file containing the list of calls per file and functions or methods. :readme content of the readme file of the project (if any)

def file_in_call(base, call, file, m_imports, call_list, orig_base, level): (source)

Undocumented

def find_file_calls(file_name, call_list): (source)

Undocumented

def find_index_init(depInfo, calls, class_init): (source)

Undocumented

def find_module_calls(module, call_list): (source)

Undocumented

def generate_output_html(pruned_json, output_file_html): (source)

Method to generate a simple HTML view of the obtained JSON. :pruned_json JSON to print out :output_file_html path where to write the HTML

def get_github_metadata(input_path: str) -> dict: (source)

Function to extract metadata from the remote repository using Github api. It requires connectivity to the Github API and the local target repository to have .git folder and a remote repository on Github. :param input_path: Path of the repository to be analyzed.

def index_to_code_token(index, code): (source)

Undocumented

def list_functions_classes_from_module(m, path): (source)

Undocumented

def parse_module(filename): (source)

Undocumented

def print_summary(json_dict): (source)

This method prints a small summary of the classes and properties recognized during the analysis. At the moment this method is only invoked when a directory with multiple files is passed.

def prune_json(json_dict): (source)

Method that given a JSON object, removes all its empty fields. This method simplifies the resultant JSON. :param json_dict input JSON file to prune :return JSON file removing empty values

def rank_software_invocation(soft_invocation_info_list): (source)

Function to create a ranking over the different ways of executing a program. If two elements have the same position in the ranking, it means that there is no priority among them. Heuristic to order the invocation list is as follows, in decreasing order of prioritization: - If package or library is detected, this will be always first. - If something (script or service) is mentioned in the readme file, it is considered a priority. - Services are prioritized over scripts - Scripts with main are prioritized over script with body. - Scripts with body are prioritized over scripts with no body. TO DOs: - If a script imports other scripts (or service), it gets prioritized (TO DO when examples are available) - If several scripts are available, those at root level are prioritized (TO DO when examples are available) :param soft_invocation_info_list JSON list with the different ways to execute a program.

def service_check(elem, software_invocation_info, server_dependencies, has_structure, readme): (source)

Undocumented

def service_in_set(data, server_dependencies, elem, software_invocation_info, has_structure, readme): (source)

Undocumented

def top_level_classes(body): (source)

Undocumented

def top_level_functions(body): (source)

Undocumented

def tree_to_token_index(root_node): (source)

Undocumented

def tree_to_variable_index(root_node, index_to_code): (source)

Undocumented

def type_module(m, i, path): (source)

Undocumented

def update_list_calls(info, index_remove): (source)

Undocumented