import discord_logging


log = discord_logging.get_logger()


class _DatabaseKeystore:
	def __init__(self):
		self.dbConn = self.dbConn  # for pycharm linting

	def save_keystore(self, key, value):
		log.debug(f"Saving keystore: {key} : {value}")
		c = self.dbConn.cursor()
		c.execute('''
			REPLACE INTO keystore
			(Key, Value)
			VALUES (?, ?)
		''', (key, value))
		self.dbConn.commit()

		return True

	def get_keystore(self, key):
		log.debug(f"Fetching keystore: {key}")
		c = self.dbConn.cursor()
		c.execute('''
			SELECT Value
			FROM keystore
			WHERE Key = ?
			''', (key,))

		result = c.fetchone()
		if result is None or len(result) == 0:
			log.debug("Key not found")
			return None

		log.debug(f"Value: {result[0]}")
		return result[0]

4681d6a744020c2500b80e9a4e52813ec818d091
<mask token>


class _DatabaseKeystore:
    <mask token>

    def save_keystore(self, key, value):
        log.debug(f'Saving keystore: {key} : {value}')
        c = self.dbConn.cursor()
        c.execute(
            '\n\t\t\tREPLACE INTO keystore\n\t\t\t(Key, Value)\n\t\t\tVALUES (?, ?)\n\t\t'
            , (key, value))
        self.dbConn.commit()
        return True
    <mask token>

<mask token>


class _DatabaseKeystore:

    def __init__(self):
        self.dbConn = self.dbConn

    def save_keystore(self, key, value):
        log.debug(f'Saving keystore: {key} : {value}')
        c = self.dbConn.cursor()
        c.execute(
            '\n\t\t\tREPLACE INTO keystore\n\t\t\t(Key, Value)\n\t\t\tVALUES (?, ?)\n\t\t'
            , (key, value))
        self.dbConn.commit()
        return True

    def get_keystore(self, key):
        log.debug(f'Fetching keystore: {key}')
        c = self.dbConn.cursor()
        c.execute(
            '\n\t\t\tSELECT Value\n\t\t\tFROM keystore\n\t\t\tWHERE Key = ?\n\t\t\t'
            , (key,))
        result = c.fetchone()
        if result is None or len(result) == 0:
            log.debug('Key not found')
            return None
        log.debug(f'Value: {result[0]}')
        return result[0]

<mask token>
log = discord_logging.get_logger()


class _DatabaseKeystore:

    def __init__(self):
        self.dbConn = self.dbConn

    def save_keystore(self, key, value):
        log.debug(f'Saving keystore: {key} : {value}')
        c = self.dbConn.cursor()
        c.execute(
            '\n\t\t\tREPLACE INTO keystore\n\t\t\t(Key, Value)\n\t\t\tVALUES (?, ?)\n\t\t'
            , (key, value))
        self.dbConn.commit()
        return True

    def get_keystore(self, key):
        log.debug(f'Fetching keystore: {key}')
        c = self.dbConn.cursor()
        c.execute(
            '\n\t\t\tSELECT Value\n\t\t\tFROM keystore\n\t\t\tWHERE Key = ?\n\t\t\t'
            , (key,))
        result = c.fetchone()
        if result is None or len(result) == 0:
            log.debug('Key not found')
            return None
        log.debug(f'Value: {result[0]}')
        return result[0]

import discord_logging
log = discord_logging.get_logger()


class _DatabaseKeystore:

    def __init__(self):
        self.dbConn = self.dbConn

    def save_keystore(self, key, value):
        log.debug(f'Saving keystore: {key} : {value}')
        c = self.dbConn.cursor()
        c.execute(
            '\n\t\t\tREPLACE INTO keystore\n\t\t\t(Key, Value)\n\t\t\tVALUES (?, ?)\n\t\t'
            , (key, value))
        self.dbConn.commit()
        return True

    def get_keystore(self, key):
        log.debug(f'Fetching keystore: {key}')
        c = self.dbConn.cursor()
        c.execute(
            '\n\t\t\tSELECT Value\n\t\t\tFROM keystore\n\t\t\tWHERE Key = ?\n\t\t\t'
            , (key,))
        result = c.fetchone()
        if result is None or len(result) == 0:
            log.debug('Key not found')
            return None
        log.debug(f'Value: {result[0]}')
        return result[0]

import discord_logging


log = discord_logging.get_logger()


class _DatabaseKeystore:
	def __init__(self):
		self.dbConn = self.dbConn  # for pycharm linting

	def save_keystore(self, key, value):
		log.debug(f"Saving keystore: {key} : {value}")
		c = self.dbConn.cursor()
		c.execute('''
			REPLACE INTO keystore
			(Key, Value)
			VALUES (?, ?)
		''', (key, value))
		self.dbConn.commit()

		return True

	def get_keystore(self, key):
		log.debug(f"Fetching keystore: {key}")
		c = self.dbConn.cursor()
		c.execute('''
			SELECT Value
			FROM keystore
			WHERE Key = ?
			''', (key,))

		result = c.fetchone()
		if result is None or len(result) == 0:
			log.debug("Key not found")
			return None

		log.debug(f"Value: {result[0]}")
		return result[0]
