Skip to content

utils

Bases: enum.Enum

Enum to define the links.

Source code in src/project/database/utils.py
36
37
38
39
40
41
42
43
44
class Links(Enum):
    """Enum to define the links.
    """
    GITHUB = 'https://github.com/shakya1527/HelperBot'
    GEMINI = 'https://ai.google.dev/'
    STREAMLIT = 'https://streamlit.io/'
    MD_PDF = 'https://pypi.org/project/mdpdf/'
    PYTHON = 'https://www.python.org/'
    SHAKYA = 'https://www.github.com/shakya1527'

States

Bases: enum.Enum

Enum to define the state keys for the session state.

Source code in src/project/database/utils.py
27
28
29
30
31
32
33
class States(Enum):
    """Enum to define the state keys for the session state.
    """
    DATABASE_STATE = 'database_state'
    CURRENT_SESSION = 'current_session'
    IS_CHAT_HISTORY_EXPANDABLE = 'is_chat_history_expandable'
    IS_CREATE_NEW_SESSION_ENABLED = 'is_create_new_session_enabled'

current_milli_time()

Get the current time in milliseconds.

Returns:

  • int ( int ) –

    Current time in milliseconds

Source code in src/project/database/utils.py
 6
 7
 8
 9
10
11
12
def current_milli_time()->int:
    """Get the current time in milliseconds.

    Returns:
        int: Current time in milliseconds
    """
    return round(time.time() * 1000)

formate_time(time_stamp)

Format the given time stamp to the given format.

Parameters:

  • time_stamp (int) –

    Time stamp to format

Returns:

  • str ( str ) –

    Formatted time

Source code in src/project/database/utils.py
15
16
17
18
19
20
21
22
23
24
def formate_time(time_stamp:int)->str:
    """Format the given time stamp to the given format.

    Args:
        time_stamp (int): Time stamp to format

    Returns:
        str: Formatted time
    """
    return datetime.fromtimestamp(time_stamp / 1000.0).strftime("%d %b %y %I:%M:%S %pages")