Пример #1
0
    def test_get_setting(self):
        ''' Make sure some settings can load.'''
        settings = brain.get_settings()

        self.assertNotEqual(None, settings.get('notes', 'home'))
        self.assertNotEqual(None, settings.get('notes', 'favorites'))
        # Default composition settings
        self.assertNotEqual(None, settings.get('compose', 'templates'))
        self.assertNotEqual(None, settings.get('compose', 'extension'))
        self.assertNotEqual(None, settings.get('compose', 'editor'))
        self.assertNotEqual(None, settings.get('compose', 'tagline'))
        # Default date format
        self.assertNotEqual(None, settings.get('date', 'format'))
Пример #2
0
    def test_get_setting(self):
        ''' Make sure some settings can load.'''
        settings = brain.get_settings()

        self.assertNotEqual(None, settings.get('notes', 'home'))
        self.assertNotEqual(None, settings.get('notes', 'favorites'))
        # Default composition settings
        self.assertNotEqual(None, settings.get('compose', 'templates'))
        self.assertNotEqual(None, settings.get('compose', 'extension'))
        self.assertNotEqual(None, settings.get('compose', 'editor'))
        self.assertNotEqual(None, settings.get('compose', 'tagline'))
        # Default date format
        self.assertNotEqual(None, settings.get('date', 'format'))
Пример #3
0
def minion_make_config(args):
    ''' Create the default config file. '''
    brain.get_settings(config_file = args['--config'])
Пример #4
0
            else:
                word_count[word] = 1
    # word_count.sort()
    print(word_count)


# Run all the things!!!!
if __name__ == '__main__':

    # Parse the input arguments; see docopt manual on github.com
    args = docopt(__doc__, version=VERSION)
    # _LOGGER.debug(args)
    CONFIG_FILE = args['--config']
    _LOGGER.info('Using config file %s', CONFIG_FILE)
# brain.CONFIG_FILE = CONFIG_FILE
    brain.GLOBAL_SETTINGS = brain.get_settings(CONFIG_FILE)

# Search terms to filter by.
    search_filter = args['<text>']
    if args['<text>'] == ['all']:
        args['<text>'] = []

    # Run any method named in the keyword args.
    # Cool hack: use DocOpt args to call methods in this file.
    # Note that this only avails those methods whose name matches a documented
    #     arg.

    for method in dir():
        argname = method.replace('minion_', '')
        if (argname in args) and args[argname]:
            if hasattr(locals()[method], '__call__'):
Пример #5
0
def minion_make_config(args):
    ''' Create the default config file. '''
    brain.get_settings(config_file=args['--config'])
Пример #6
0
            else:
                word_count[word] = 1
    # word_count.sort()
    print word_count


# Run all the things!!!!
if __name__ == '__main__':

    # Parse the input arguments; see docopt manual on github.com
    args = docopt(__doc__, version=VERSION)
    # _LOGGER.debug(args)
    CONFIG_FILE = args['--config']
    _LOGGER.info('Using config file %s', CONFIG_FILE)
    # brain.CONFIG_FILE = CONFIG_FILE
    brain.GLOBAL_SETTINGS = brain.get_settings(CONFIG_FILE)

    # Search terms to filter by.
    search_filter = args['<text>']
    if args['<text>'] == ['all']:
        args['<text>'] = []

    # Run any method named in the keyword args.
    # Cool hack: use DocOpt args to call methods in this file.
    # Note that this only avails those methods whose name matches a documented
    #     arg.

    for method in dir():
        argname = method.replace('minion_', '')
        if (argname in args) and args[argname]:
            if hasattr(locals()[method], '__call__'):