# Path: studio/util/util.py
# def rand_string(length):
#     return "".join([random.choice(string.ascii_letters + string.digits)
#                     for n in range(length)])
# 
# def check_for_kb_interrupt():
#     current_exc = sys.exc_info()[1]
#     if current_exc is None:
#         return
#     if isinstance(current_exc, KeyboardInterrupt):
#         raise current_exc
#     return
# 
# Path: studio/pyrebase.py
#     RSA = None
# NUM_RETRIES = 3
# POOL_SIZE = 100
# def initialize_app(config):
#     def __init__(self, config):
#     def auth(self):
#     def database(self):
#     def storage(self):
#     def __init__(self, api_key, requests, credentials):
#     def sign_in_with_email_and_password(self, email, password):
#     def create_custom_token(self, uid, additional_claims=None):
#     def sign_in_with_custom_token(self, token):
#     def refresh(self, refresh_token):
#     def get_account_info(self, id_token):
#     def send_email_verification(self, id_token):
#     def send_password_reset_email(self, email):
#     def verify_password_reset_code(self, reset_code, new_password):
#     def create_user_with_email_and_password(self, email, password):
#     def __init__(self, credentials, api_key, database_url, requests):
#     def order_by_key(self):
#     def order_by_value(self):
#     def order_by_child(self, order):
#     def start_at(self, start):
#     def end_at(self, end):
#     def equal_to(self, equal):
#     def limit_to_first(self, limit_first):
#     def limit_to_last(self, limit_last):
#     def shallow(self):
#     def child(self, *args):
#     def build_request_url(self, token, shallow=False):
#     def build_headers(self, token=None):
#     def get(self, token=None, json_kwargs={}, shallow=False):
#     def push(self, data, token=None, json_kwargs={}):
#     def set(self, data, token=None, json_kwargs={}):
#     def update(self, data, token=None, json_kwargs={}):
#     def remove(self, token=None):
#     def stream(self, stream_handler, token=None, stream_id=None):
#     def check_token(self, database_url, path, token):
#     def generate_key(self):
#     def sort(self, origin, by_key):
#     def __init__(self, credentials, storage_bucket, requests):
#     def child(self, *args):
#     def put(self, file, token=None, userid='guest'):
#     def _put_file(self, path, file_object, token, userid):
#         def post_file(**kwargs):
#             def _post_file():
#                 def patch_owner():
#     def delete(self, name):
#     def download(self, filename, token=None):
#             def _download_internal():
#     def get_url(self, token):
#     def list_files(self):
#     def __init__(self, statuscode, message):
# def raise_detailed_error(request_object):
# def convert_to_pyre(items):
# def convert_list_to_pyre(items):
#     def __init__(self, pyres, query_key):
#     def val(self):
#     def key(self):
#     def each(self):
#     def __init__(self, item):
#     def val(self):
#     def key(self):
#     def rebuild_auth(self, prepared_request, response):
#     def __init__(self, *args, **kwargs):
#     def _connect(self):
#     def close(self):
#     def __init__(self, url, stream_handler, build_headers, stream_id):
#     def make_session(self):
#     def start(self):
#     def start_stream(self):
#     def close(self):
# class Firebase:
# class Auth:
# class Database:
# class Storage:
# class HTTPServerError(Exception):
# class PyreResponse:
# class Pyre:
# class KeepAuthSession(Session):
# class ClosableSSEClient(SSEClient):
# class Stream:
# 
# Path: studio/util/logs.py
# DEBUG = logging.DEBUG
# INFO = logging.INFO
# ERROR = logging.ERROR
# def get_logger(name):
# def debug(line):
# def error(line):
# def info(line):


import os
import getpass
import time
import json
import shutil
import atexit
import tempfile
import requests
import re
import uuid
import google.auth.transport.requests
import google.oauth2.id_token
from builtins import input
    from apscheduler.schedulers.background import BackgroundScheduler
from studio.util.util import rand_string, check_for_kb_interrupt
from studio import pyrebase
from studio.util import logs
                self.sign_in_with_email()
                self.expired = False
            else:
                self.expired = True
        else:
            # If json file fails to load, try again
            counter = 0
            user = None
            while True:
                if user is not None or counter >= MAX_NUM_RETRIES:
                    break
                try:
                    with open(self.token_file) as f:
                        user = json.loads(f.read())
                except BaseException as e:
                    check_for_kb_interrupt()
                    self.logger.info(e)
                    time.sleep(SLEEP_TIME)
                    counter += 1
            if user is None:
                return

            self.user = user
            if time.time() > self.user.get('expiration', 0):
                counter = 0
                while counter < MAX_NUM_RETRIES:
                    try:
                        self.refresh_token(user['email'], user['refreshToken'])
                        break
                    except BaseException as e:

# Path: studio/util/util.py
# def rand_string(length):
#     return "".join([random.choice(string.ascii_letters + string.digits)
#                     for n in range(length)])
# 
# def check_for_kb_interrupt():
#     current_exc = sys.exc_info()[1]
#     if current_exc is None:
#         return
#     if isinstance(current_exc, KeyboardInterrupt):
#         raise current_exc
#     return
# 
# Path: studio/pyrebase.py
#     RSA = None
# NUM_RETRIES = 3
# POOL_SIZE = 100
# def initialize_app(config):
#     def __init__(self, config):
#     def auth(self):
#     def database(self):
#     def storage(self):
#     def __init__(self, api_key, requests, credentials):
#     def sign_in_with_email_and_password(self, email, password):
#     def create_custom_token(self, uid, additional_claims=None):
#     def sign_in_with_custom_token(self, token):
#     def refresh(self, refresh_token):
#     def get_account_info(self, id_token):
#     def send_email_verification(self, id_token):
#     def send_password_reset_email(self, email):
#     def verify_password_reset_code(self, reset_code, new_password):
#     def create_user_with_email_and_password(self, email, password):
#     def __init__(self, credentials, api_key, database_url, requests):
#     def order_by_key(self):
#     def order_by_value(self):
#     def order_by_child(self, order):
#     def start_at(self, start):
#     def end_at(self, end):
#     def equal_to(self, equal):
#     def limit_to_first(self, limit_first):
#     def limit_to_last(self, limit_last):
#     def shallow(self):
#     def child(self, *args):
#     def build_request_url(self, token, shallow=False):
#     def build_headers(self, token=None):
#     def get(self, token=None, json_kwargs={}, shallow=False):
#     def push(self, data, token=None, json_kwargs={}):
#     def set(self, data, token=None, json_kwargs={}):
#     def update(self, data, token=None, json_kwargs={}):
#     def remove(self, token=None):
#     def stream(self, stream_handler, token=None, stream_id=None):
#     def check_token(self, database_url, path, token):
#     def generate_key(self):
#     def sort(self, origin, by_key):
#     def __init__(self, credentials, storage_bucket, requests):
#     def child(self, *args):
#     def put(self, file, token=None, userid='guest'):
#     def _put_file(self, path, file_object, token, userid):
#         def post_file(**kwargs):
#             def _post_file():
#                 def patch_owner():
#     def delete(self, name):
#     def download(self, filename, token=None):
#             def _download_internal():
#     def get_url(self, token):
#     def list_files(self):
#     def __init__(self, statuscode, message):
# def raise_detailed_error(request_object):
# def convert_to_pyre(items):
# def convert_list_to_pyre(items):
#     def __init__(self, pyres, query_key):
#     def val(self):
#     def key(self):
#     def each(self):
#     def __init__(self, item):
#     def val(self):
#     def key(self):
#     def rebuild_auth(self, prepared_request, response):
#     def __init__(self, *args, **kwargs):
#     def _connect(self):
#     def close(self):
#     def __init__(self, url, stream_handler, build_headers, stream_id):
#     def make_session(self):
#     def start(self):
#     def start_stream(self):
#     def close(self):
# class Firebase:
# class Auth:
# class Database:
# class Storage:
# class HTTPServerError(Exception):
# class PyreResponse:
# class Pyre:
# class KeepAuthSession(Session):
# class ClosableSSEClient(SSEClient):
# class Stream:
# 
# Path: studio/util/logs.py
# DEBUG = logging.DEBUG
# INFO = logging.INFO
# ERROR = logging.ERROR
# def get_logger(name):
# def debug(line):
# def error(line):
# def info(line):


# Path: studio/auth.py
import os
import getpass
import time
import json
import shutil
import atexit
import tempfile
import requests
import re
import uuid
import google.auth.transport.requests
import google.oauth2.id_token
from builtins import input
    from apscheduler.schedulers.background import BackgroundScheduler
from studio.util.util import rand_string, check_for_kb_interrupt
from studio import pyrebase
from studio.util import logs

                self.sign_in_with_email()
                self.expired = False
            else:
                self.expired = True
        else:
            # If json file fails to load, try again
            counter = 0
            user = None
            while True:
                if user is not None or counter >= MAX_NUM_RETRIES:
                    break
                try:
                    with open(self.token_file) as f:
                        user = json.loads(f.read())
                except BaseException as e:
                    check_for_kb_interrupt()
                    self.logger.info(e)
                    time.sleep(SLEEP_TIME)
                    counter += 1
            if user is None:
                return

            self.user = user
            if time.time() > self.user.get('expiration', 0):
                counter = 0
                while counter < MAX_NUM_RETRIES:
                    try:
                        self.refresh_token(user['email'], user['refreshToken'])
                        break
                    except BaseException as e:

                        check_for_kb_interrupt()