From 165e25dac0f3d9f1bd88925bde334cd4eddfa03c Mon Sep 17 00:00:00 2001 From: "matthias@arch" Date: Wed, 23 Nov 2022 20:33:59 +0100 Subject: [PATCH] changed imports --- regina/collect.py | 4 ++-- regina/database.py | 2 +- regina/regina.py | 16 +++++++++------- regina/visualize.py | 4 ++-- setup.py | 4 ++-- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/regina/collect.py b/regina/collect.py index 774e4aa..26706db 100644 --- a/regina/collect.py +++ b/regina/collect.py @@ -1,9 +1,9 @@ import sqlite3 as sql from re import match from time import mktime -from database import t_request, t_user, t_file, t_filegroup, database_tables, get_filegroup -from sql_util import sanitize, sql_select, sql_exists, sql_insert, sql_tablesize from datetime import datetime as dt +from .database import t_request, t_user, t_file, t_filegroup, database_tables, get_filegroup +from .sql_util import sanitize, sql_select, sql_exists, sql_insert, sql_tablesize """ collect information from the access log and put it into the database diff --git a/regina/database.py b/regina/database.py index d93e779..43d1481 100644 --- a/regina/database.py +++ b/regina/database.py @@ -1,6 +1,6 @@ import sqlite3 as sql -from sql_util import sanitize, sql_select, sql_exists, sql_insert, sql_tablesize from os import path, listdir +from .sql_util import sanitize, sql_select, sql_exists, sql_insert, sql_tablesize """ diff --git a/regina/regina.py b/regina/regina.py index b690f06..fdbd26e 100644 --- a/regina/regina.py +++ b/regina/regina.py @@ -1,10 +1,9 @@ -from enum import auto -from collect import parse_log, add_requests_to_db from sys import argv, exit -from database import create_db -from os.path import isfile, isdir -from visualize import visualize -from settings_manager import read_settings_file +from os.path import isfile +from .visualize import visualize +from .settings_manager import read_settings_file +from .collect import parse_log, add_requests_to_db +from .database import create_db """ start regina, launch either collect or visualize @@ -64,7 +63,7 @@ def error(arg): print("Error:", arg) exit(1) -if __name__ == '__main__': +def main(): config_file = "" collect = False visualize_ = False @@ -110,3 +109,6 @@ if __name__ == '__main__': if visualize_: if not isfile(settings["db"]): error(f"Invalid database path: '{settings['db']}'") visualize(settings) + +if __name__ == '__main__': + main() diff --git a/regina/visualize.py b/regina/visualize.py index ca795c6..db012b4 100644 --- a/regina/visualize.py +++ b/regina/visualize.py @@ -1,12 +1,12 @@ import sqlite3 as sql from sys import argv, exit -from database import t_request, t_user, t_file, t_filegroup, database_tables -from sql_util import sanitize, sql_select, sql_exists, sql_insert, sql_tablesize, sql_get_count_where from re import fullmatch, findall import matplotlib.pyplot as plt import matplotlib as mpl from os.path import isdir from datetime import datetime as dt +from .database import t_request, t_user, t_file, t_filegroup, database_tables +from .sql_util import sanitize, sql_select, sql_exists, sql_insert, sql_tablesize, sql_get_count_where """ visualize information from the databse TODO: diff --git a/setup.py b/setup.py index 642debb..f818d5e 100755 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( license="GPLv3", packages=["regina"], - install_requires=["sqlite3"], + install_requires=[], classifiers=[ "Operating System :: POSIX :: Linux", @@ -25,6 +25,6 @@ setup( # scripts=["bin/nicole"], entry_points={ - "console_scripts": [ "regina=regina.main:main" ], + "console_scripts": [ "regina=regina.regina:main" ], }, )