decompy.database package

Submodules

decompy.database.db module

class decompy.database.db.Database(database_name='c_source', default_tables=True)[source]

Bases: object

Class for database. Accepts a name to create a new database, and use the database based off of that name.

create_connection(db_file)[source]

create a database connection to the SQLite database specified by db_file :param db_file: database file :return: Connection object or None

create_table(create_table_sql)[source]

create a table from the create_table_sql statement :param create_table_sql: a CREATE TABLE statement :return: bool or nothing.

delete_meta(author_repo_key, override=False)[source]

delete meta data with this repo name, and the ml data as a result of cascading. :param author_repo_key: the author repo key from Github used to uniquely identify each situation. :param override: whether or not to override the transaction builder. Useful if we want it immediately or not going to have greater than 1000 transactoins. :return: bool

delete_ml(file_name)[source]

delete ml data with this file name. :param file_name: the file name to delete. :param override: whether or not to override the transaction builder. Useful if we want it immediately or not going to have greater than 1000 transactoins. :return: nothing

find_file(file_name)[source]

finds a file by the name, and get all its files :param file_name: the info for one file. :return: sql info or none

find_repo(repo)[source]

finds a repo by the name, and get all its files :param repo: the repository :return: sql info or none

get_repos(limit=100)[source]

gets 100 random repos, or the number provided :param limit: the number of random repos to get :return:

get_repos_pagination(limit=100)[source]

get pagination repos, defaults to 100 queries :return: nothing

insert_meta(meta_tuple, override=False)[source]

inserts or replaces if it exists new meta row by adding it to the transaction builder into the meta table or replaces existing one. :param meta_tuple: the meta tuple to add the info. Contains author_repo_key, repo_name, license, url, author, filter_approval_date, llvm_gen_date, filter_date, compilation_date, master_download_date, and whether or not to override. :type: tuple - str (not null), str (not null), str, str (not null), str (not null), str (not null), str (not null), str (not null), str (not null), str (not null) :param override: to override the transaction to immediately process the query or not. :type: bool :return: bool or nothing

insert_ml(ml_tuple, override=False)[source]

inserts or replaces, if it exists, a new ml row by adding it to the transaction builder. Can override. :param ml_tuple: file_path, author_repo_key, source_code, cleaned_source_code, object_file, llvm_unop, and llvm_op :type: tuple - str (not null), str (not null), str (not null), str (not null), binary (not null), str (not null), str (not null),

binary (not null), str (not null)
Parameters:override – to override the transaction to immediately process the query or not.
Type:bool
Returns:bool or nothing

Module contents