Did I find the right examples for you? yes no

All Samples(5)  |  Call(3)  |  Derive(0)  |  Import(2)
Sets the value of a particular key in the config file. This has no effect when setting to the same value.

        def set_value(repo_directory, key, value, strict=True):
    """Sets the value of a particular key in the config file. This has no effect when setting to the same value."""
    if value is None:
        raise ValueError('Argument "value" must not be None.')

    # Read values and do nothing if not making any changes
    config = read_config(repo_directory)
    old = config.get(key)
    if old == value:
        return old

    # Check schema
    if strict and old is not None and not isinstance(old, type(value)):
        raise ConfigSchemaError('Expected config variable %s to be type %s, got %s'
            % (repr(key), repr(type(value)), repr(type(old))))

    # Set new value and save results
    config[key] = value
    write_config(repo_directory, config)
    return old
        


src/g/i/gitpress-HEAD/gitpress/plugins.py   gitpress(Download)
from .config import get_value, set_value
from .repository import require_repo
 
 
def list_plugins(directory=None):
 
    plugins[plugin] = {}
    set_value(repo, 'plugins', plugins)
    return True
 
 
    del plugins[plugin]
    set_value(repo, 'plugins', plugins)
    return True
 

src/g/i/gitpress-HEAD/gitpress/themes.py   gitpress(Download)
import os
from .repository import require_repo
from .config import set_value
 
 
        raise ThemeNotFoundError(theme)
 
    old_theme = set_value(repo, 'theme', theme)
    return old_theme != theme