Removed unused imports, added date parser for db info data
This commit is contained in:
@@ -6,7 +6,6 @@ from PySide6.QtCore import QObject, Signal, Slot
|
||||
from artemis.utils.path_utils import DATA_DIR
|
||||
from artemis.utils.generic_utils import *
|
||||
from artemis.utils.sql_utils import ArtemisDatabase
|
||||
from artemis.utils.constants import Constants
|
||||
from artemis.utils.sys_utils import delete_dir
|
||||
|
||||
|
||||
@@ -57,7 +56,7 @@ class UIdbmanager(QObject):
|
||||
{
|
||||
'name': db.name,
|
||||
'version': db.version,
|
||||
'date': db.date,
|
||||
'date': parse_date(db.date),
|
||||
'db_dir_name': db.db_dir_name,
|
||||
'documents_n': db.stats['documents'],
|
||||
'signals_n': db.stats['signals'],
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from datetime import datetime
|
||||
|
||||
from artemis.utils.constants import Query
|
||||
|
||||
|
||||
@@ -75,3 +77,17 @@ def generate_filter_query(filer_status):
|
||||
))
|
||||
|
||||
return ' INTERSECT '.join(query)
|
||||
|
||||
|
||||
def parse_date(date_str):
|
||||
""" Parses a date string in "%Y-%m-%d %H:%M:%S.%f" format and returns
|
||||
the date in "YYYY-MM-DD" format. If parsing fails, returns the original string.
|
||||
|
||||
Args:
|
||||
date_str (str): The date string to parse.
|
||||
"""
|
||||
try:
|
||||
form_date = datetime.strptime(date_str, "%Y-%m-%d %H:%M:%S.%f")
|
||||
return str(form_date.date())
|
||||
except ValueError:
|
||||
return date_str
|
||||
|
||||
@@ -7,8 +7,8 @@ from datetime import datetime
|
||||
from contextlib import closing
|
||||
|
||||
from artemis.utils.constants import Query, Constants
|
||||
from artemis.utils.path_utils import DATA_DIR
|
||||
from artemis.utils.generic_utils import format_frequency
|
||||
from artemis.utils.path_utils import DATA_DIR
|
||||
|
||||
|
||||
class Database():
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import os
|
||||
import uuid
|
||||
import requests
|
||||
|
||||
from packaging.version import Version
|
||||
|
||||
from artemis.utils.constants import Constants, Messages
|
||||
from artemis.utils.sql_utils import ArtemisDatabase
|
||||
from artemis.utils.sys_utils import is_windows, is_linux, is_macos, delete_file, delete_dir, match_hash, unpack_tar, open_file
|
||||
from artemis.utils.sys_utils import is_windows, is_linux, is_macos, delete_file, match_hash, unpack_tar, open_file
|
||||
from artemis.utils.path_utils import DATA_DIR, TMP_DIR
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user