How to use the tinydb.TinyDB.DEFAULT_STORAGE function in tinydb

To help you get started, we’ve selected a few tinydb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pengchenglin / ATX-Test / Public / ATX_Server.py View on Github external
serial	     0642f8d6f0ec9d1a
model        Nexus 5
....         ...
===============================================
"""

import logging

from tinydb import TinyDB, where
from tinydb.storages import MemoryStorage, JSONStorage
import requests
import re

logger = logging.getLogger(__name__)

TinyDB.DEFAULT_STORAGE = MemoryStorage


class ATX_Server(object):
    """
    According to users requirements to select devices
    """

    def __init__(self, url):
        """
        Construct method
        """
        self._db = TinyDB(storage=MemoryStorage)
        if url and re.match(r"(http://)?(\d+\.\d+\.\d+\.\d+:\d+)", url):
            if '://' not in url:
                url = 'http://' + url + '/list'
            else:
github RedQA / stf-selector / stf_selector / selector.py View on Github external
serial	     778d4f10
platform	 android
mode         Plusm A
....         ...
===============================================
"""

import logging

from stf import STF
from tinydb import TinyDB
from tinydb.storages import MemoryStorage

logger = logging.getLogger(__name__)

TinyDB.DEFAULT_STORAGE = MemoryStorage


class Selector(object):
    """
    According to user's requirements to select devices
    """

    def __init__(self, url=None, token=None):
        """
        Construct method
        """
        self._db = TinyDB(storage=MemoryStorage)
        self._url = url
        self._token = token

    def load(self):
github schapman1974 / tinymongo / tinymongo / tinymongo.py View on Github external
This property is also useful to define Serializers using required
        `tinydb-serialization` module.

            from tinymongo.serializers import DateTimeSerializer
            from tinydb_serialization import SerializationMiddleware
            class CustomClient(TinyMongoClient):
                @property
                def _storage(self):
                    serialization = SerializationMiddleware()
                    serialization.register_serializer(
                        DateTimeSerializer(), 'TinyDate')
                    # register other custom serializers
                    return serialization

        """
        return TinyDB.DEFAULT_STORAGE
github RedQA / stf-selector / stf_selector / db.py View on Github external
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from tinydb import TinyDB
from tinydb.storages import MemoryStorage, JSONStorage


class DB(TinyDB):
    # To modify the default storage for all TinyDB instances
    TinyDB.DEFAULT_STORAGE = MemoryStorage
    pass


class MemStroage(MemoryStorage):
    pass


class JsonStorage(JSONStorage):
    pass
github pengchenglin / ATX-Test / Public / atxserver2.py View on Github external
model        Nexus 5
....         ...
===============================================
"""

import logging

from tinydb import TinyDB, where
from tinydb.storages import MemoryStorage, JSONStorage
import requests
import re
from Public.ReadConfig import ReadConfig

logger = logging.getLogger(__name__)

TinyDB.DEFAULT_STORAGE = MemoryStorage

token = ReadConfig().get_server_token()


class atxserver2(object):
    """
    According to users requirements to select devices
    """

    def __init__(self, url):
        """
        Construct method
        """
        self._db = TinyDB(storage=MemoryStorage)
        if url and re.match(r"(http://)?(\d+\.\d+\.\d+\.\d+:\d+)", url):
            if '://' not in url: