# Path: firebase_admin/credentials.py
# class Base:
# class Certificate(Base):
# class ApplicationDefault(Base):
# class RefreshToken(Base):
#     def get_access_token(self):
#     def get_credential(self):
#     def __init__(self, cert):
#     def project_id(self):
#     def signer(self):
#     def service_account_email(self):
#     def get_credential(self):
#     def __init__(self):
#     def get_credential(self):
#     def project_id(self):
#     def _load_credential(self):
#     def __init__(self, refresh_token):
#     def client_id(self):
#     def client_secret(self):
#     def refresh_token(self):
#     def get_credential(self):
# def _is_file_path(path):
#     _CREDENTIAL_TYPE = 'service_account'
#     _CREDENTIAL_TYPE = 'authorized_user'
# 
# Path: firebase_admin/db.py
# _DB_ATTRIBUTE = '_database'
# _INVALID_PATH_CHARACTERS = '[].?#$'
# _RESERVED_FILTERS = ('$key', '$value', '$priority')
# _USER_AGENT = 'Firebase/HTTP/{0}/{1}.{2}/AdminPython'.format(
#     firebase_admin.__version__, sys.version_info.major, sys.version_info.minor)
# _TRANSACTION_MAX_RETRIES = 25
# _EMULATOR_HOST_ENV_VAR = 'FIREBASE_DATABASE_EMULATOR_HOST'
#     _DEFAULT_AUTH_OVERRIDE = '_admin_'
# def reference(path='/', app=None, url=None):
# def _parse_path(path):
#     def __init__(self, sse_event):
#     def data(self):
#     def path(self):
#     def event_type(self):
#     def __init__(self, callback, sse):
#     def _start_listen(self):
#     def close(self):
#     def __init__(self, **kwargs):
#     def key(self):
#     def path(self):
#     def parent(self):
#     def child(self, path):
#     def get(self, etag=False, shallow=False):
#     def get_if_changed(self, etag):
#     def set(self, value):
#     def set_if_unchanged(self, expected_etag, value):
#     def push(self, value=''):
#     def update(self, value):
#     def delete(self):
#     def listen(self, callback):
#     def transaction(self, transaction_update):
#     def order_by_child(self, path):
#     def order_by_key(self):
#     def order_by_value(self):
#     def _add_suffix(self, suffix='.json'):
#     def _listen_with_session(self, callback, session=None):
#     def __init__(self, **kwargs):
#     def limit_to_first(self, limit):
#     def limit_to_last(self, limit):
#     def start_at(self, start):
#     def end_at(self, end):
#     def equal_to(self, value):
#     def _querystr(self):
#     def get(self):
#     def __init__(self, message):
#     def __init__(self, results, order_by):
#     def get(self):
#     def __init__(self, key, value, order_by):
#     def key(self):
#     def index(self):
#     def index_type(self):
#     def value(self):
#     def _get_index_type(cls, index):
#     def _extract_child(cls, value, path):
#     def _compare(self, other):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __gt__(self, other):
#     def __ge__(self, other):
#     def __eq__(self, other):
#     def __init__(self, app):
#     def get_client(self, db_url=None):
#     def _get_emulator_config(self, parsed_url):
#     def _parse_emulator_url(cls, parsed_url):
#     def _get_auth_override(cls, app):
#     def close(self):
#     def __init__(self, credential, base_url, timeout, params=None):
#     def request(self, method, url, **kwargs):
#     def create_listener_session(self):
#     def handle_rtdb_error(cls, error):
#     def _extract_error_message(cls, response):
# class Event:
# class ListenerRegistration:
# class Reference:
# class Query:
# class TransactionAbortedError(exceptions.AbortedError):
# class _Sorter:
# class _SortEntry:
# class _DatabaseService:
# class _Client(_http_client.JsonHttpClient):


import firebase_admin
    import firebase_admin
    import firebase_admin
    import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
    from firebase_admin import credentials
    from firebase_admin import db
    from firebase_admin import credentials
    from firebase_admin import db
    from firebase_admin import credentials
    from firebase_admin import db
    from firebase_admin import db
    from firebase_admin import db

def run_transaction():
    # [START transaction]
    def increment_votes(current_value):
        return current_value + 1 if current_value else 1

    upvotes_ref = db.reference('server/saving-data/fireblog/posts/-JRHTHaIs-jNPLXOQivY/upvotes')
    try:
        new_vote_count = upvotes_ref.transaction(increment_votes)
        print('Transaction completed')
    except db.TransactionAbortedError:
        print('Transaction failed to commit')
    # [END transaction]

def read_value():
    # [START read_value]
    # Import database module.

    # Get a database reference to our posts
    ref = db.reference('server/saving-data/fireblog/posts')

    # Read the data at the posts reference (this is a blocking operation)
    print(ref.get())
    # [END read_value]

def order_by_child():
    # [START order_by_child]
    ref = db.reference('dinosaurs')
    snapshot = ref.order_by_child('height').get()
    for key, val in snapshot.items():

# Path: firebase_admin/credentials.py
# class Base:
# class Certificate(Base):
# class ApplicationDefault(Base):
# class RefreshToken(Base):
#     def get_access_token(self):
#     def get_credential(self):
#     def __init__(self, cert):
#     def project_id(self):
#     def signer(self):
#     def service_account_email(self):
#     def get_credential(self):
#     def __init__(self):
#     def get_credential(self):
#     def project_id(self):
#     def _load_credential(self):
#     def __init__(self, refresh_token):
#     def client_id(self):
#     def client_secret(self):
#     def refresh_token(self):
#     def get_credential(self):
# def _is_file_path(path):
#     _CREDENTIAL_TYPE = 'service_account'
#     _CREDENTIAL_TYPE = 'authorized_user'
# 
# Path: firebase_admin/db.py
# _DB_ATTRIBUTE = '_database'
# _INVALID_PATH_CHARACTERS = '[].?#$'
# _RESERVED_FILTERS = ('$key', '$value', '$priority')
# _USER_AGENT = 'Firebase/HTTP/{0}/{1}.{2}/AdminPython'.format(
#     firebase_admin.__version__, sys.version_info.major, sys.version_info.minor)
# _TRANSACTION_MAX_RETRIES = 25
# _EMULATOR_HOST_ENV_VAR = 'FIREBASE_DATABASE_EMULATOR_HOST'
#     _DEFAULT_AUTH_OVERRIDE = '_admin_'
# def reference(path='/', app=None, url=None):
# def _parse_path(path):
#     def __init__(self, sse_event):
#     def data(self):
#     def path(self):
#     def event_type(self):
#     def __init__(self, callback, sse):
#     def _start_listen(self):
#     def close(self):
#     def __init__(self, **kwargs):
#     def key(self):
#     def path(self):
#     def parent(self):
#     def child(self, path):
#     def get(self, etag=False, shallow=False):
#     def get_if_changed(self, etag):
#     def set(self, value):
#     def set_if_unchanged(self, expected_etag, value):
#     def push(self, value=''):
#     def update(self, value):
#     def delete(self):
#     def listen(self, callback):
#     def transaction(self, transaction_update):
#     def order_by_child(self, path):
#     def order_by_key(self):
#     def order_by_value(self):
#     def _add_suffix(self, suffix='.json'):
#     def _listen_with_session(self, callback, session=None):
#     def __init__(self, **kwargs):
#     def limit_to_first(self, limit):
#     def limit_to_last(self, limit):
#     def start_at(self, start):
#     def end_at(self, end):
#     def equal_to(self, value):
#     def _querystr(self):
#     def get(self):
#     def __init__(self, message):
#     def __init__(self, results, order_by):
#     def get(self):
#     def __init__(self, key, value, order_by):
#     def key(self):
#     def index(self):
#     def index_type(self):
#     def value(self):
#     def _get_index_type(cls, index):
#     def _extract_child(cls, value, path):
#     def _compare(self, other):
#     def __lt__(self, other):
#     def __le__(self, other):
#     def __gt__(self, other):
#     def __ge__(self, other):
#     def __eq__(self, other):
#     def __init__(self, app):
#     def get_client(self, db_url=None):
#     def _get_emulator_config(self, parsed_url):
#     def _parse_emulator_url(cls, parsed_url):
#     def _get_auth_override(cls, app):
#     def close(self):
#     def __init__(self, credential, base_url, timeout, params=None):
#     def request(self, method, url, **kwargs):
#     def create_listener_session(self):
#     def handle_rtdb_error(cls, error):
#     def _extract_error_message(cls, response):
# class Event:
# class ListenerRegistration:
# class Reference:
# class Query:
# class TransactionAbortedError(exceptions.AbortedError):
# class _Sorter:
# class _SortEntry:
# class _DatabaseService:
# class _Client(_http_client.JsonHttpClient):


# Path: snippets/database/index.py
import firebase_admin
    import firebase_admin
    import firebase_admin
    import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
    from firebase_admin import credentials
    from firebase_admin import db
    from firebase_admin import credentials
    from firebase_admin import db
    from firebase_admin import credentials
    from firebase_admin import db
    from firebase_admin import db
    from firebase_admin import db


def run_transaction():
    # [START transaction]
    def increment_votes(current_value):
        return current_value + 1 if current_value else 1

    upvotes_ref = db.reference('server/saving-data/fireblog/posts/-JRHTHaIs-jNPLXOQivY/upvotes')
    try:
        new_vote_count = upvotes_ref.transaction(increment_votes)
        print('Transaction completed')
    except db.TransactionAbortedError:
        print('Transaction failed to commit')
    # [END transaction]

def read_value():
    # [START read_value]
    # Import database module.

    # Get a database reference to our posts
    ref = db.reference('server/saving-data/fireblog/posts')

    # Read the data at the posts reference (this is a blocking operation)
    print(ref.get())
    # [END read_value]

def order_by_child():
    # [START order_by_child]
    ref = db.reference('dinosaurs')
    snapshot = ref.order_by_child('height').get()
    for key, val in snapshot.items():

        print('{0} was {1} meters tall'.format(key, val))