# Buggy code
def set(
    self,
    path,
    value,
    force=False,
    defaults=None,
    config=None,
    preprocessors=None,
    error_on_path=False,
):
    if not path:
        if error_on_path:
            raise NoSuchSettingsPath()
        return

    if self._mtime is not None and self.last_modified != self._mtime:
        self.load()

    if config is not None or defaults is not None:
        if config is None:
            config = self._config

        if defaults is None:
            defaults = dict(self._map.parents)

        chain = HierarchicalChainMap(config, defaults)
    else:
        chain = self._map

    if preprocessors is None:
        preprocessors = self._set_preprocessors

    preprocessor = None
    try:
        preprocessor = self._get_by_path(path, preprocessors)
    except NoSuchSettingsPath:
        pass

    if callable(preprocessor):
        value = preprocessor(value)

    try:
        current = chain.get_by_path(path)
    except KeyError:
        current = None

    try:
        default_value = chain.get_by_path(path, only_defaults=True)
    except KeyError:
        if error_on_path:
            raise NoSuchSettingsPath()
        default_value = None

    in_local = chain.has_path(path, only_local=True)
    in_defaults = chain.has_path(path, only_defaults=True)

    if not force and in_defaults and in_local and default_value == value:
        try:
            chain.del_by_path(path)
            self._dirty = True
            self._dirty_time = time.time()
        except KeyError:
            if error_on_path:
                raise NoSuchSettingsPath()
            pass
    elif (
        force
        or (not in_local and in_defaults and default_value != value)
        or (in_local and current != value)
    ):
        if value is None and in_local:
            chain.del_by_path(path)
        else:
            chain.set_by_path(path, value)
        self._dirty = True
        self._dirty_time = time.time()


# Traceback (TypeError)
2018-08-04 08:31:37,135 - octoprint - ERROR - Exception on /api/settings [POST]
Traceback (most recent call last):
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/util/flask.py", line 1140, in decorated_view
return flask_login.login_required(func)(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask_login.py", line 758, in decorated_view
return func(*args, **kwargs)
File "/home/pi/oprint/local/lib/python2.7/site-packages/flask_principal/__init__.py", line 198, in _decorated
rv = f(*args, **kw)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/api/settings.py", line 294, in setSettings
response = _saveSettings(data)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/server/api/settings.py", line 418, in _saveSettings
if "timeoutTemperatureAutoreport" in data["serial"]: s.setFloat(["serial", "timeout", "temperatureAutoreport"], data["serial"]["timeoutTemperatureAutoreport"], minimum=0.0)
File "/home/pi/oprint/local/lib/python2.7/site-packages/octoprint/settings.py", line 1688, in setFloat
self.set(path, floatValue, **kwargs)
TypeError: set() got an unexpected keyword argument 'minimum'
2018-08-04 08:31:37,141 - tornado.access - ERROR - 500 POST /api/settings (::ffff:192.168.200.8) 24.39ms
2018-08-04 08:34:48,675 - octoprint.server.heartbeat - INFO - Server heartbeat <3

# Fixed code
def set(
    self,
    path,
    value,
    force=False,
    defaults=None,
    config=None,
    preprocessors=None,
    error_on_path=False,
    *args,
    **kwargs,
):
    if not path:
        if error_on_path:
            raise NoSuchSettingsPath()
        return

    if self._mtime is not None and self.last_modified != self._mtime:
        self.load()

    if config is not None or defaults is not None:
        if config is None:
            config = self._config

        if defaults is None:
            defaults = dict(self._map.parents)

        chain = HierarchicalChainMap(config, defaults)
    else:
        chain = self._map

    if preprocessors is None:
        preprocessors = self._set_preprocessors

    preprocessor = None
    try:
        preprocessor = self._get_by_path(path, preprocessors)
    except NoSuchSettingsPath:
        pass

    if callable(preprocessor):
        value = preprocessor(value)

    try:
        current = chain.get_by_path(path)
    except KeyError:
        current = None

    try:
        default_value = chain.get_by_path(path, only_defaults=True)
    except KeyError:
        if error_on_path:
            raise NoSuchSettingsPath()
        default_value = None

    in_local = chain.has_path(path, only_local=True)
    in_defaults = chain.has_path(path, only_defaults=True)

    if not force and in_defaults and in_local and default_value == value:
        try:
            chain.del_by_path(path)
            self._dirty = True
            self._dirty_time = time.time()
        except KeyError:
            if error_on_path:
                raise NoSuchSettingsPath()
            pass
    elif (
        force
        or (not in_local and in_defaults and default_value != value)
        or (in_local and current != value)
    ):
        if value is None and in_local:
            chain.del_by_path(path)
        else:
            chain.set_by_path(path, value)
        self._dirty = True
        self._dirty_time = time.time()