How to use the confuse.TypeTemplate function in confuse

To help you get started, we’ve selected a few confuse 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 beetbox / confuse / test / test_valid.py View on Github external
def test_set_type_as_template(self):
        typ = confuse.as_template(set)
        self.assertIsInstance(typ, confuse.TypeTemplate)
        self.assertEqual(typ.typ, set)
        self.assertEqual(typ.default, confuse.REQUIRED)
github beetbox / confuse / test / test_valid.py View on Github external
def test_incorrect_type(self):
        config = _root({'foo': dict()})
        with self.assertRaises(confuse.ConfigTypeError):
            config['foo'].get(confuse.TypeTemplate(set))
github beetbox / confuse / test / test_valid.py View on Github external
def test_missing_required_value(self):
        config = _root({})
        with self.assertRaises(confuse.NotFoundError):
            config['foo'].get(confuse.TypeTemplate(set))
github buluba89 / Yatcobot / yatcobot / config / __init__.py View on Github external
import yaml

logger = logging.getLogger(__name__)


class Config:
    base_template = {
        'twitter': {
            'consumer_key': confuse.String(),
            'consumer_secret': confuse.String(),
            'access_token_key': confuse.String(),
            'access_token_secret': confuse.String(),
            'min_ratelimit_percent': confuse.Integer(),

            'search': {
                'queries': confuse.TypeTemplate(list),
                'max_queue': confuse.Integer(),
                'max_quote_depth': confuse.Integer(),
                'min_quote_similarity': confuse.Number(),
                'skip_retweeted': confuse.TypeTemplate(bool),
                # Is updated on runtime
                'filter': {},
                # Is updated on runtime
                'sort': {},
            },
            # Is updated on runtime
            'actions': {},
            'scheduler': {
                'search_interval': confuse.Integer(),
                'retweet_interval': confuse.Integer(),
                'retweet_random_margin': confuse.Integer(),
                'blocked_users_update_interval': confuse.Integer(),
github buluba89 / Yatcobot / yatcobot / plugins / actions.py View on Github external
def get_config_template():
        template = {
            'enabled': confuse.TypeTemplate(bool),
            'keywords': confuse.StrSeq(),
            'max_following': confuse.Integer(),
            'multiple': confuse.TypeTemplate(bool)
        }
        return template
github buluba89 / Yatcobot / yatcobot / plugins / ratings.py View on Github external
def get_config_template():
        template = {
            'enabled': confuse.TypeTemplate(bool),
            'keywords': confuse.StrSeq()
        }
        return template
github buluba89 / Yatcobot / yatcobot / plugins / notifiers.py View on Github external
def get_config_template():
        template = {
            'enabled': confuse.TypeTemplate(bool),
            'host': confuse.String(),
            'port': confuse.Integer(),
            'tls': confuse.TypeTemplate(bool),
            'username': confuse.String(),
            'password': confuse.String(),
            'recipient': confuse.String()
        }
        return template
github buluba89 / Yatcobot / yatcobot / plugins / ratings.py View on Github external
def get_config_template():
        template = {
            'enabled': confuse.TypeTemplate(bool),
        }
        return template