refactor: add black formatting

This commit is contained in:
Krrish Dholakia 2023-12-25 14:10:38 +05:30
parent b87d630b0a
commit 4905929de3
156 changed files with 19723 additions and 10869 deletions

View file

@ -2,6 +2,7 @@
Routes between admin, auth, keys pages
"""
from dotenv import load_dotenv
load_dotenv()
import streamlit as st
import base64, binascii, os
@ -9,18 +10,20 @@ from admin import admin_page
from auth import auth_page
from urllib.parse import urlparse, parse_qs
# Parse the query params in the URL
def get_query_params():
# Get the query params from Streamlit's `server.request` function
# This functionality is not officially documented and could change in the future versions of Streamlit
query_params = st.experimental_get_query_params()
return query_params
query_params = st.experimental_get_query_params()
return query_params
def is_base64(sb):
try:
if isinstance(sb, str):
# Try to encode it to bytes if it's a unicode string
sb_bytes = sb.encode('ascii')
sb_bytes = sb.encode("ascii")
elif isinstance(sb, bytes):
sb_bytes = sb
else:
@ -36,10 +39,11 @@ def is_base64(sb):
except (binascii.Error, ValueError):
# If an error occurs, return False, as the input is not base64
return False
# Check the URL path and route to the correct page based on the path
query_params = get_query_params()
page_param = query_params.get('page', [None])[0]
page_param = query_params.get("page", [None])[0]
# Route to the appropriate page based on the URL query param
if page_param: