# Path: studio/util/util.py
# def retry(f,
#           no_retries=5, sleep_time=1,
#           exception_class=BaseException, logger=None):
#     for i in range(no_retries):
#         try:
#             return f()
#         except exception_class as exc:
#             check_for_kb_interrupt()
#             if i == no_retries - 1:
#                 raise exc
# 
#             if logger:
#                 logger.info(
#                     ('Exception {0} is caught, ' +
#                      'sleeping {1}s and retrying (attempt {2} of {3})')
#                         .format(exc, sleep_time, i, no_retries))
#             time.sleep(sleep_time)
#     return None


import requests
import json
import math
import time
import threading
import socket
import certifi
    import python_jwt as jwt
import datetime
from requests import Session
from requests.exceptions import HTTPError
    from urllib.parse import urlencode, quote
    from urllib import urlencode, quote
from random import uniform
from collections import OrderedDict
from sseclient import SSEClient
from oauth2client.service_account import ServiceAccountCredentials
from requests.packages.urllib3.contrib.appengine import is_appengine_sandbox
from requests_toolbelt.adapters import appengine
    from Crypto.PublicKey import RSA
from studio.util.util import retry
        from google.cloud import storage
        def post_file(**kwargs):
            def _post_file():
                request_object = self.requests.post(
                    request_ref, data=file_object, **kwargs)
                raise_detailed_error(request_object)
                return request_object

            return retry(
                _post_file,
                no_retries=10,
                sleep_time=5,
                exception_class=HTTPServerError)

        if token:
            headers = {"Authorization": "Firebase " + token}

            request_object = post_file(headers=headers)
            if userid:
                headers['Content-Type'] = 'application/json'

                def patch_owner():
                    patch_request = self.requests.patch(
                        request_ref,
                        headers=headers,
                        data=json.dumps({'metadata': {'owner': userid}})
                    )

                    raise_detailed_error(patch_request)
                    return patch_request


# Path: studio/util/util.py
# def retry(f,
#           no_retries=5, sleep_time=1,
#           exception_class=BaseException, logger=None):
#     for i in range(no_retries):
#         try:
#             return f()
#         except exception_class as exc:
#             check_for_kb_interrupt()
#             if i == no_retries - 1:
#                 raise exc
# 
#             if logger:
#                 logger.info(
#                     ('Exception {0} is caught, ' +
#                      'sleeping {1}s and retrying (attempt {2} of {3})')
#                         .format(exc, sleep_time, i, no_retries))
#             time.sleep(sleep_time)
#     return None


# Path: studio/pyrebase.py
import requests
import json
import math
import time
import threading
import socket
import certifi
    import python_jwt as jwt
import datetime
from requests import Session
from requests.exceptions import HTTPError
    from urllib.parse import urlencode, quote
    from urllib import urlencode, quote
from random import uniform
from collections import OrderedDict
from sseclient import SSEClient
from oauth2client.service_account import ServiceAccountCredentials
from requests.packages.urllib3.contrib.appengine import is_appengine_sandbox
from requests_toolbelt.adapters import appengine
    from Crypto.PublicKey import RSA
from studio.util.util import retry
        from google.cloud import storage

        def post_file(**kwargs):
            def _post_file():
                request_object = self.requests.post(
                    request_ref, data=file_object, **kwargs)
                raise_detailed_error(request_object)
                return request_object

            return retry(
                _post_file,
                no_retries=10,
                sleep_time=5,
                exception_class=HTTPServerError)

        if token:
            headers = {"Authorization": "Firebase " + token}

            request_object = post_file(headers=headers)
            if userid:
                headers['Content-Type'] = 'application/json'

                def patch_owner():
                    patch_request = self.requests.patch(
                        request_ref,
                        headers=headers,
                        data=json.dumps({'metadata': {'owner': userid}})
                    )

                    raise_detailed_error(patch_request)
                    return patch_request


                retry(